I have been using asynchronous requests for a long time. so the response was processed in a callback function. I thought of not using async so i made synchronous requests. The reason is that i dont have to have two more lines for checking the status and the onreadystatechange....
my synchronous requests would be like this...
var jax = createAjax(); // this function returns the XMLHTTPRequest object
jax.open('POST',url,false); //here false is to do sync request.
// once the above line is executed the process waits for the response and when it gets the response form the server then the next line is executed.
alert(jax.responseText); // here i process the response text.
so from the code you can understand that there is no need of a callback function and if conditions to check ready state... ...
So there is no problem in the above code. The problem araises here...
Do we have to check whether the page is navigating away while in synchronous operation and abort the request?
or what could be the reason for the error. This will not happen in async requests because that is also the reason for async...
so i give a sync request and before the response is received if i navigate away or reload the page i get the error.