• Home
  • Recent Q&A
  • Java
  • Cloud
  • JavaScript
  • Python
  • SQL
  • PHP
  • HTML
  • C++
  • Data Science
  • DBMS
  • Devops
  • Hadoop
  • Machine Learning
in React JS by
Q:

What is difference between  Synchronous and Asynchronous?

1 Answer

0 votes
by

Synchronous ( async: false ) – 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. Synchronous part:

$.ajax({    url: "file.php",         type: "POST",         async: false,         success: function(data) {

         }      });

Asynchronous (in Ajax) processes incoming requests in a constant event stack and sends small requests one after the other without waiting for responses. In other words, asynchronous ajax call allow the next line of code to execute, whereas synchronous call stop JavaScript execution until the response from server.

Related questions

0 votes
asked Jan 30, 2020 in Selenium by rajeshsharma
0 votes
asked Feb 23 in React JS by SakshiSharma
...