开发者

on what http status codes are ajax failure/error callbacks called?

开发者 https://www.devze.com 2023-04-04 16:17 出处:网络
for a standard ajax call : $.ajax({ url: \'http://www.nodomainajaxcallhere.fail/busted.nogo\', error: ----,

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/

0

精彩评论

暂无评论...
验证码 换一张
取 消