我在Firefox中遇到了一些奇怪的ajax错误,当我使用谷歌浏览器时我没有得到:
这是我的ajax代码,可以捕获此错误:
$(document).ajaxError(function (e, xhr, opt, thrownError) {
swal({
title: xhr.status + " " + xhr.statusText,
//text: "Error requesting : " + opt.url +" "+ thrownError,
text: xhr.responseText,
type: "error",
timer: 15000
});
submit.removeClass('m-loader m-loader--right m-loader--light').attr('disabled', false);
});
这里是必要时的响应截图:
答案 0 :(得分:0)
尝试在$( document).ready(function() { });
函数中包装AJAX调用。