xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
document.getElementById("myDiv").innerHTML = xmlhttp.responseText;
}
}
Above code is from:http://www.w3schools.com/ajax/ajax_xmlhttprequest_onreadystatechange.asp.
Question:
According to this tutorial:
readyState: 4: request finished and response is ready
status: 200: "OK"
When readyState is 4 and status is 200, the response is ready:
since when xmlhttp.readyState == 4
, response is ready, why do we still need xmlhttp.status == 200
? what is the difference between xmlhttp.readyState == 4
and xmlhttp.status == 200
?