is it possible to catch anything that comes from the server via ajax ?
I know that the ajaxComplete() fires when some ajax work completes
I would like to e.g.
alert(whichever content came from the server as a result for $.ajax, $.post, $.get)
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.
jQuery.ajaxCompleteshould do just fine.The documentation says that the response will be in
XHR.responseHTMLorXHR.responseXML, but I suspect the latter might be a typo, since my empirical test show that the two members present areXHR.responseTextandXHR.responseHTML.But then again, my tests weren’t exhaustive and didn’t take in account the mime type returned by the server, so don’t take my word for it, as I might be horribly mistaken.
Also this example blatantly ignores the status code returned and should by no means be taken as a good example, merely as a possible starting point.
See an ugly running demo