How i can catch http code status in dataFilter? Have the following code:
$.ajaxSetup ({
dataFilter: function (data) {
//need know http status for change data
return data;
}
});
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.
You cannot do this using the dataFilter. From the docs:
Plus the
ajaxSetupthat you are referencing is used to define default ajax settings for when you make a jQuery ajax call. That code does not actually make an ajax call.There is a
statusCodeattribute to the jQuery ajax method that has what you are looking for. You could also usesuccessanderrorwhich are called depending on the resulting status code.Read up on all of this in the docs: jQuery.ajax() API