in React JS by

What is difference between  Synchronous and Asynchronous?

1 Answer

0 votes

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
+2 votes
asked Nov 26, 2022 in AJAX by SakshiSharma
0 votes
asked Jun 26, 2020 in React JS by AdilsonLima