How can I check the status of an AJAX request with jQuery? In normal AJAX we can do this:
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("myDiv").innerHTML = xmlhttp.responseText;
}
}
The
$.ajax()method in jQuery has bothsuccessanderrorhandlers depending on the state of the response.