Fires whenever the readyState of the request changes. Mostly used to determine whether the body of the response is available for handling.
Overview Table Synchronous No Bubbles No Target apis/xhr/XMLHttpRequest Cancelable No Default action## Examples
The following script demonstrates how to set an asynchronous event handler that alerts the user when the readyState property of the request reaches complete (4
). Note that you must set the event handler after calling open, which resets all properties of the XMLHttpRequest object to their initial value.
function reportStatus() {
if (xhr.readyState == 4 ) {
if (xhr.status == 200 || xhr.status == 304) {
console.log("Transfer complete.");
}
else {
}
}
}
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://localhost/test.xml", true);
xhr.onreadystatechange = reportStatus;
xhr.send();
Related specifications
Microsoft Developer Network: Windows Internet Explorer API reference Article
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4