How To Run AJAX Syncrhonously

SJAX (Syncrhonous Javascript and XML) is the opposite of AJAX. Sometimes we need to run things in a linear fashion. Doing so is easy. When you call the open() function to open the URL, just set the third parameter to false. Also, since we set it to false, there is no need to set up an onreadystatechange handler. Call the send() function right away and wait for the response returned by the server with the responseText variable. See code below.

Related Posts Plugin for WordPress, Blogger...

Leave a Reply

Your email address will not be published. Required fields are marked *