Easy learning with example program codes

difference between ajax synchronous and asynchronous

Let’s see the open method signature first.

open(method,url,async,user,psw): It specifies the request.

method: the request type GET or POST
url: the file location
async: true (asynchronous) or false (synchronous)
user: optional user name
psw: optional password

Synchronous: We can send one request at one time and have to wait for the response before send the second request. i.e. It blocks the client browser until operation completes.

For Synchronous request set the async parameter to false.

Example:"GET", "test.txt", false);

Asynchronous: We can send other request before getting the response of first request. i.e. It does not blocks the client browser.

For Asynchronous request set the async parameter to true.

Example:"GET", "test.txt", true);
Posted in Ajax   

Copyright © 2018 CodesJava Protection Status SiteMap