How to call the Ajax ready states on the jQuery $.ajax method?
How to call the Ajax ready states on the jQuery $.ajax method?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
$.ajax()returns the XmlHttpRequest object, so if you really want to access it as the state changes, you can do this:But the built-in callbacks should be all you need for most uses, particularly
successandcomplete.To do things before the request fires, use
beforeSend, or more appropriately for most cases, the.ajaxStart()and.ajaxStop()events…for example to show a loading message whenever any ajax activity is going on.