在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/