AJAX onreadystatechange & readyState
I have a question re onreadystatechange & readyState. I have this code:
what happens if xmlhttp.readyState isn't 4 (completed)?
if (xmlhttp.readyState==4 && xmlhttp.status==200)
i have a piece of code where a couple of calls are made to different forms/divs and sometimes the xmlhttp.readyState isn't 4 and values that were supposed to be send to one form/div are in fact sent to another.
it's, as I understand it, because xmlhttp.responseText is still being directed to different div.
how do I make the code 'wait' for xmlhttp.readyState==4?