jquery - jQuery : IE11 AJAX error handler not giving error information

标签 jquery ajax internet-explorer error-handling

在Firefox和IE11中,JQuery从AJAX调用获取的错误信息之间存在很大的差异:

ajaxData = {id: 1234, quantity: 3};
$.ajax({
    type: 'POST',
    url: BASE_URL + 'ajax/this-page-does-not-exist.php',
    dataType: 'json',
    data: ajaxData,
    error: function(xhr, textStatus, errorThrown){
        // in Firefox:
        //  - xhr.responseText has the "Not found" HTML message returned by the server
        //  - xhr.status is 404
        //  - textStatus is 'error'
        //  - errorThrown is 'Not Found'
        // in IE11:
        //  - xhr.responseText is empty
        //  - xhr.status is 0
        //  - textStatus is 'error'
        //  - errorThrown is empty

    },
    success: function(data, textStatus, xhr){
        // ...
    }
});

这是怎么了?

最佳答案

这可能与我在这里询问的内容相同:

IE11 returns status 0 during Ajax POST operation from an iFrame (XMLHttpRequest: Network Error 0x2ee4)

微软表示,他们将调查该问题。

关于jquery - jQuery : IE11 AJAX error handler not giving error information,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23086185/

相关文章:

jquery - IE 中非常奇怪的 url,页面 404 错误

javascript - 在 Internet Explorer 中交换选项框?

internet-explorer - IE 11 "bulletproof"字体和后备字体不起作用

javascript - 网站在 FF 中根本不显示,但在 Chrome 和 IE 中运行良好

jquery - 如何使用jquery比较两张卡是否匹配?

javascript - 下载从 onClick 方法返回的文件

JQuery:多个复选框可禁用多个文本框

javascript - 如何使用 jQuery Ajax 后响应参数

javascript - CORS - 服务器如何知道是否使用了 Jquery ajax 的 "withCredentials : true"?

php - AJAX提交表单无刷新,无法正常工作