Ten common mistakes when using Ajax

Source: Internet
Author: User
I read an Ajax article on DflyingChen, just like practicing English translation. due to my limited degree, Please criticize and correct it. The author of this article is the author of the. netajajax framework Ajax. NETProfessional (AjaxPro ).

I read an Ajax article about Dflying Chen, just like practicing English translation. due to my limited degree, Please criticize and correct it.

The author of this article is Michael Schwarz, the author of. NET Ajax framework Ajax. NET Professional (AjaxPro ).

Last month, I invented many web websites that applied ajax in large numbers, but some of them were amazing because their speed was slower than before and sometimes did not work (on mobile devices ), I have summarized ten Ajax errors (platform-independent)

1. do not update all pages by placing all pages in UpdatePanel. You need to save time when running web pages. do not update those parts that can use javascript and DHTML (DOM.

2. always remember that there are several visitors who cannot use JavaScript or use a version that is better than the old browser or that have poor support for JavaScript, such as mobile devices. If none of these are supported, what can visitors see?

3. cache the same request in the client browser or the cache on the we server. The best example is to take the initiative to complete a drop-down menu. Their filling is the same at any time. an active writing method with incorrect writing can slow down your Web server (database server ), because that would have more requests than previously used IsPostBack. Keep pressing F5 to refresh your webpage. If you have a stacked drop-down menu, you will settle more requests.

4. when you apply CSS or JavaScript, do not run the Ajax request that is concurrent or has been running for a long time, generally, a browser can only have two concurrent http connections (I know this can be changed, but it is still set to two by default ). The speed would be slow if I had to make a lot of Ajax requests when reading images.

5. When to use an Asynchronous call to send XMLHttpRequest .. If you want to use the synchronous method, your browser will not be frozen due to the network Title or slow connection speed.

6. try to make your web application use a very slow network connection and try a fast TCP/IP connection.

7. Is your web application a replacement product for desktop applications? You have noticed that the browser is generally running your Web application in memory for one hour, two hours, or several days. Not everyone has machines as good as you.

8. check your http request status code (status code) when you return XMLHttpRequest. there will be some common network errors such as inaccessible DNS, Http Server error 500, you have checked the status code, which tells you that the browser is in a connection mode.

9. try to disable XMLHttpRequest object! In IE7, you can use native object instead of ActiveX object, but you can also disable native object.

10. check the security of your AJAX requests! Did you briefly open your data access layer? Apply FormsAuthentication and PrincipalPermissions. Can anyone create a request (not just click a link )?



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.