Ajax use of gossip may also be Luantan _ajax related

Source: Internet
Author: User
With the advent and prevalence of Ajax technology, JavaScript scripts that are overlooked as second-rate programming languages have also begun to flourish, with a large number of JavaScript frameworks appearing, such as Microsoft ASP.net Ajax, jquery, and so on. Ajax has become an essential part of these scripting frameworks, and the development of Ajax is becoming more and more simplistic.

Ajax is an already not loaded script, and its oldest implementation is to use the IFRAME to load remote scripts using top. function to invoke the method of the parent form. Specified using the target attribute of HTML such as a. Simple but late maintenance is complicated and troublesome to cross over. Then on the appearance of XMLHttpRequest objects, a certain degree of simplification of the development of Ajax, but in different browsers to achieve a lot of different, Firefox XMLHttpRequest and IE in the activeobject and other ways, And it only provides very little and simple AJAX requests and processing. There are a lot of javascript frameworks in the now, XMLHttpRequest encapsulation and the availability of class libraries, which greatly simplifies our AJAX programming. One of the most famous and popular jquery frameworks. What you need to say here is that jquery is a good place to implement cross-domain problems.

Below I will say a few of their current thinking of Ajax attention or skills, thinking may be a bit messy, please understand, will be bad, please forgive.

X in 1:ajax is XML, it can also easily load XML, but I personally think that the shelf ah XML is a bad way. First of all, we all know that XML is a strict way to store data, with a lot of redundant information. Moreover, the processing of XML also has some complexity. XML can achieve cross-platform, such as WebService, which is the advantage of WebService, but also a fatal disadvantage, it is based on the XML redundancy information, so the speed is also very slow in the distributed.

In contrast, a JSON object is a lightweight storage method that is stored as a name-value pair. And the JavaScript script itself is a natural JSON object that can be used directly without conversion, and now. NET Framework provides support for JSON serialization. My personal opinion is the preferred JSON.

2: On the server side for performance considerations often have caching, as well as browser caching. Sometimes we need to avoid, the simplest way is to add a timestamp, "default.aspx?time=" + DateTime.Now. You can avoid caching. If you're using jquery ajax, you can set Cache:false to disable caching directly.

3: In AJAX programming to note is Content-type, there are HTML, Text, Json, XML, script and so on. Many of our unreasonable mistakes are often set here. Attention needs to be paid to the Ajax Content-type and the content-type of the service-side output. There is also the server side that we want to output before the Response.Clear (), Response.contenttype=type, and the completion of Response.Flush () and Response.clos ().

4:ajax is not a highly interactive, high user experience representative, which needs to be explained. Our application should not be the preferred Ajax technology, because if the Ajax technology is not very good, it will backfire. Also, if you want to use Ajax, then we have to prepare for the customer retreat, because the AJAX request can be a variety of reasons for error.

5:ajax is based on client-side scripting, which means that there are certain security risks that can easily expose some of our sensitive information. In particular, the online scripting code erosion, some of us often in the online copy down just to join our project, I think this is a very bad habit. It's easy to lose the candle.

Time is late, say so much, if you have any experience or suggestions please leave a message. If you do not understand the question can also leave a message, I will try to reply as soon as possible.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.