on what http status codes are ajax failure/error callbacks called?
for a standard ajax call :
$.ajax({
url: 'http://www.nodomainajaxcallhere.fail/busted.nogo',
error: ----,
failu开发者_如何学运维re: ----,
...
})
I thought that any respond with status code 200 is success and all other are automatically failure. But today I first saw "error" callback.
when is the failure callback called? on a connection error? when is the error callback called? on any other exception? http status code 400 ?
If you're talking about JQuery, then none of the documentation for jQuery.ajax
refers to a "failure" callback. They only talk about "error". I suspect this is either an anachronism, or someone was confused as to what the antonym of "success" was in this case.
http://api.jquery.com/jQuery.ajax/
精彩评论