What jQuery.ajax answers are considered "success"?

I have a jQuery AJAX mail request that unexpectedly calls the error callback instead of success . One random suspicion that I have is the status code 302, which it receives, although this may be incorrect.

I looked at the documentation , but I feel that one thing is a bit unclear: what is the jQuery definition of a successful query?

+8
javascript jquery ajax
source share
1 answer

If the response is 199 to 300 (> = 200 and <300) or 304, and responseText can be successfully converted to the data type you provided (default text), it is considered successful.

For example, if you return JSON and get a response status of 200, but it fails, it is more likely that the JSON parser problem means that your JSON is invalid.

If you return HTML or XML and it fails with a response status of 200, the answeretext cannot be converted to HTML or XML respectively (this usually happens in IE with invalid html / xml)

+6
source share

All Articles