x

Choose Country Code

x

Direction

x

Ask a Question

  • Ask a Question
  • Scan a Question
  • Post MCQ
  • Note: File extension must be of jpg, jpeg, png, bmp format and file size must not exceed 5 MB
x

Ask a Question

x

x
x
x
Hire a Tutor

Answers and Solutions

What's Your Question?
Answer

Difference between wait and no wait.

Answer

Synchronous way: It waits for each operation to complete, after that only it executes the next operationFor your query: The console.log() command will not be executed until & unless the query has finished executing to get all the result from Database.

Asynchronous way: It never waits for each operation to complete, rather it executes all operations in the first GO only. The result of each operation will be handled once the result is available. For your query: The console.log() command will be executed soon after the Database.Query() method. While the Database query runs in the background and loads the result once it is finished retrieving the data.

Answer

a) synchronous (wnere the script stops and waits for the server to send back a reply before continuing)

 

b) asynchronous (where the script allows the page to continue to be processed and will handle the reply if and when it arrives).

<script> // ... $.ajax(... async: false ...); // Hey browser! first complete this request, // then go for other codes $.ajax(...); // Executed after the completion of the previous async:false request. </script>

By default, the$.ajaxrequest in jQuery is set to asynchronous. The variable name is async and the value is set to true

Post Answer and Earn Credit Points

Get 5 credit points for each correct answer. The best one gets 25 in all.

Post Answer