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.
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.
xhttp.open("GET", "test.txt", true);