This article is in need of a technical review.
Summary
The onreadystatechange event is triggered every time the readyState attribute of the XMLHttpRequest changes. The callback is called from the user interface thread.
Syntax
XMLHttpRequest.onreadystatechange = callback;
callback is the function to be executed when the readyState changes.
Example
var xmlhttp = new XMLHttpRequest() , method = 'GET' , url = 'https://developer.mozilla.org/';
xmlhttp.open( method , url , true );
xmlhttp.onreadystatechange = function () {
if ( 4 != xmlhttp.readyState ) {
return;
}
if ( 200 != xmlhttp.status ) {
return;
}
console.log( xmlhttp.responseText );
};
xmlhttp.send();

