xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
document.getElementById("myDiv").innerHTML = xmlhttp.responseText;
}
}
以上代码来自:http ://www.w3schools.com/ajax/ajax_xmlhttprequest_onreadystatechange.asp 。
问题:
根据本教程:
readyState: 4: request finished and response is ready
status: 200: "OK"
When readyState is 4 and status is 200, the response is ready:
从什么时候起xmlhttp.readyState == 4
,响应就准备好了,为什么我们还需要xmlhttp.status == 200
?xmlhttp.readyState == 4
和有什么区别xmlhttp.status == 200
?