AJAX requests Synchronous Vs Asynchronous

Is there any difference in performance ( speed wise ) between a synchronous request and and asynchronous request?

What all are the reasons for using an asynchronous request??


You should mostly always use an asynchronous Ajax Request, in fact I know only about one place where a synchronous Ajax Request should be used which is if you're in an Ajax Request embedding a new JavaScript file on the client and then referencing types and/or objects from that JavaScript file in the return from the original Ajax Request. Then the fetching of this new JS file should (or can sanely) be included through using a synchronous Ajax Request...

Other then that you should always use asynchronous Ajax Requests. The most important reason is that a synchronous Ajax Request makes the UI (browser) unresponsive...


there can be serious performance implications caused when it come to highly database intensive applications .. although it's very unlikely to happen .. and sending many Synchronous ajax calls can create a backlog .. so if the application database intensive and sending so many request at once it is better to make it asynchronous. when its set to asynch the browser will fail all unresponsive request and continue with new once..

链接地址: http://www.djcxy.com/p/55330.html

上一篇: 模拟一个同步的XmlHttpRequest

下一篇: AJAX请求异步与异步