Ten common errors when using Ajax

Source: Internet
Author: User

I read an Ajax document about dflying Chen.ArticleIt's like practicing English. Due to your limited level, please criticize and correct me.

The author of this article is Michael Schwarz, a well-known. Net Ajax framework Ajax. net Professional (ajaxpro ).

Last month, I found that many Web websites used Ajax in large quantities, but some of them were strange 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 the entire page by placing the entire page 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, older browsers, or their poor support for Javascript, such as mobile devices. If none of these are supported, What can your visitors see?

3. cache the same request in the client browser or execute the cache on the we server. The best example is to automatically complete a drop-down menu. Their filling is the same at any time. An automatic writing method with incorrect writing can slow down your web server (Database Server ), because there will be more requests than previously using ispostback. Keep pressing F5 to refresh your webpage. If you have a stacked drop-down menu, you will settle more requests.

4. When you use CSS or Javascript, do not run Ajax requests that are concurrent or run 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 ). If you make a lot of Ajax requests when reading images, the speed will become very slow.

5. When to use an asynchronous call to send XMLHttpRequest .. If you want to use the synchronous method, there is no problem. Your browser will not be frozen due to network problems 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. Your Web application is used as a desktopProgram? You have observed the memory usage of browsers when running your web application for one hour, two hours, or a few days. Not everyone has machines as good as you.

8. Check your HTTP Request status when you return XMLHttpRequestCode(Status code), there will be some common network errors such as inaccessible DNS, HTTP Server Error 500, you have checked the status code ), it 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 simply open your data access layer? Make full use of formsauthentication and principalpermissions. Can anyone create a request (not just click a link )?

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.