About the status attribute value of the XMLHTTPRequest object in Ajax
In Ajax, the status attribute of the XMLHTTPRequest object is generally used to return the HTTP status code of the server. Status 200 indicates "successful", and status 404 indicates "Page not found ". Many books are written in this way, which is not bad at all.
However, sometimes, especially when learning AjaxCodeRun it locally. In this case, the problem occurs. If running locally (for example, c: \ Ajax \ helloworld.htm), the status attribute returns 0 if it is "successful" or "not found on the page, instead of 200 and 404. At this time, if you still use if (XMLHTTP. Status = 200) to judge the operation, there will be no results. If you want to test it locally, you 'd better write it as if (XMLHTTP. Status = 200 | XMLHTTP. Status = 0.
As I mentioned earlier, this does not mean that many books orArticleIs wrong. Because all these articles write the status returned from the server, but they do not say that the returned status from the local server is missing.