AJAX requests Synchronous Vs Asynchronous

后端 未结 3 1300
忘了有多久
忘了有多久 2021-01-11 13:07

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

3条回答
  •  臣服心动
    2021-01-11 13:49

    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...

提交回复
热议问题