Firefox上的Jquery ajax错误0

时间:2018-06-17 09:13:18

标签: jquery ajax firefox

我在Firefox中遇到了一些奇怪的ajax错误,当我使用谷歌浏览器时我没有得到:

enter image description here

这是我的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);
        });

这里是必要时的响应截图:

enter image description here

1 个答案:

答案 0 :(得分:0)

尝试在$( document).ready(function() { });函数中包装AJAX调用。