CodesJava

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.

Where:
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:

xhttp.open("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:

xhttp.open("GET", "test.txt", true);
Posted in Ajax   
Sign Up/ Sign In
Ask a Question


Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at hr@codesjava.com.

Development

We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on hr@codesjava.com.

Copyright © 2018 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki