AJAX requests Synchronous Vs Asynchronous AJAX requests Synchronous Vs Asynchronous ajax ajax

AJAX requests Synchronous Vs Asynchronous


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


@Thomas Hansen answer is right but I found a clear explanation with benefits of Asynchronous.

Synchronous is simple, but wait for the server response, thus block the execution of the caller for a period and slower than asynchronous while processing the request.

Asynchronous is required setting, do not wait after submitting the request and immediately return control to the caller, thus faster than Synchronous.

I am coming here when I have to use upload control which has both functionalities in the question and looking the pros and cons of this functionality.

I got the another link which explained with a real example. (the link is the specific tool, so understand the logic)

  • The major difference is the response time from our servers. At the time of upload, synchronous will validate file and create the passcode in real-time. Asynchronous will send the file to our server's queue and deliver notification via email once it is processed.

  • Synchronous is not ideal for multiple, large CSV file since you will need to wait until the file is processed by the server to submit another request. On large files, this also may cause your browsers to return with timeout errors due to the server being too busy. If you have multiple files, asynchronous will allow you to submit multiple files to the server queue to be processed with a email receipt once completed.

https://www.aspsnippets.com/Articles/Difference-between-Synchronous-Sync-and-Asynchronous-Async-Request-Call-in-AJAX.aspx


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