开发者

What is ajax error?

What server response cause ajaxError on browser Ajax handler? Is this error code different from 200 or not empty special json field开发者_Go百科?


Yes, non-200 response codes can cause an error, you can see what constitutes "success" here:

httpSuccess: function( xhr ) {
    try {
        // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
        return !xhr.status && location.protocol === "file:" ||
            xhr.status >= 200 && xhr.status < 300 ||
            xhr.status === 304 || xhr.status === 1223;
    } catch(e) {}

    return false;
}

This is as of jQuery 1.4.4, previous a status code of 0 was also successful, because Opera 304 was reported as a 0...that leniency has since been removed to eliminate false positives for success. If the above check is false, the error handler is called.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜