Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Sets or retrieves the event handler for asynchronous requests.
Syntax
[ vHandler = ] object.onreadystatechange [ = v ]
Possible Values
vHandler Variant that specifies or receives the event handler. The property is read/write. The property has no default value.
Remarks
onreadystatechange was introduced in Windows Internet Explorer 7.
Example
The following script demonstrates how to set an event handler that responds to asynchronous events:
function reportStatus() { if (oReq.readyState == 4) alert('Transfer complete.'); } var oReq = new XMLHttpRequest(); oReq.onreadystatechange = reportStatus; oReq.open("GET", "https://localhost/test.xml", true); oReq.send();
Standards Information
This property is defined in The XMLHttpRequest Object (W3C Working Draft)
.
Applies To
See Also
Please sign in to use this experience.
Sign in