1. How Ajax Works
2. Synchronization
The XMLHttpRequest object is used to exchange data with the server.
The async parameter of the open () method must be set to True if the XMLHttpRequest object is to be used with AJAX:
Xmlhttp.open ("GET","ajax_test.html",true);
Instead of waiting for a response from the server, Ajax,javascript does:
- Execute additional scripts while waiting for the server to respond
- Handle responses when they are ready
3. Asynchronous
To use Async=false, change the third parameter in the open () method to False:
Xmlhttp.open (" Get","test1.txt",false);
We do not recommend the use of Async=false, but for some small requests it is also possible.
Keep in mind that JavaScript waits until the server responds in readiness to continue. If the server is busy or slow, the application hangs or stops.
Ajax Synchronous vs. asynchronous