Asynchronous vs Synchronous Ajax

Synchronous 

Script stops and waits for the server to send back a reply before continuing. There are some situations where Synchronous Ajax is mandatory.

In standard Web applications, the interaction between the customer and the server is synchronous. This means that one has to happen after the other. If a customer clicks a link, the request is sent to the server, which then sends the results back.

Because of the danger of a request getting lost and hanging the browser, synchronous javascript isn’t recommended for anything outside of (onbefore)unload event handlers, but if you need to hear back from the server before you can allow the user to navigate away from the page, synchronous Javascript isn’t just your best option.

Asynchronous vs Synchronous Ajax

Asynchronous

Where the script allows the page to continue to be processed and will handle the reply if and when it arrives. If anything goes wrong in the request and/or transfer of the file, your program still has the ability to recognize the problem and recover from it.
Processing asynchronously avoids the delay while the retrieval from the server is taking place because your visitor can continue to interact with the web page and the requested information will be processed with the response updating the page as and when it arrives.

Asynchronous vs Synchronous
<<Previous <<   || Index ||   >>Next >>

 

Previous
Next

14 Comments

  1. brijesh July 3, 2014
  2. Java Lover @ 135 July 16, 2014
  3. vergin July 17, 2014
  4. Viswanathan Saravanan September 9, 2014
  5. Dinesh Rajput September 9, 2014
  6. Viswanathan Saravanan September 9, 2014
  7. Dinesh Rajput September 9, 2014
  8. Nelson October 15, 2014
  9. Dinesh Rajput October 16, 2014
  10. Dinesh Rajput October 16, 2014
  11. Nguyễn Văn Sơn January 21, 2015
  12. Dinesh Rajput January 22, 2015
  13. Bruno Maia Serralheiro February 5, 2015
  14. Bruno Maia Serralheiro February 5, 2015