首页 服务 产品 文档 关于

jQuery.handleError is not a function错误

handlerError只在jQuery-1.4.2之前的版本中存在,jQuery-1.4.2之后的版本中都没有这个函数了

所以jquery.form提交时有时候会提示该错误。


在jquery引用之后的某个js中加入:

jQuery.extend({
    handleError: function (s, xhr, status, e) {
        if (s.error) {
            s.error.call(s.context || s, xhr, status, e);
        }
        if (s.global) {
            (s.context ? jQuery(s.context) : jQuery.event).trigger("ajaxError", [xhr, s, e]);
        }
    },
    httpData: function (xhr, type, s) {
        var ct = xhr.getResponseHeader("content-type"),
            xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0,
            data = xml ? xhr.responseXML : xhr.responseText;
        if (xml && data.documentElement.tagName == "parsererror")
            throw "parsererror";
        if (s && s.dataFilter)
            data = s.dataFilter(data, type);
        if (typeof data === "string") {
            if (type == "script")
                jQuery.globalEval(data);
            if (type == "json")
                data = window["eval"]("(" + data + ")");
        }
        return data;
    }
});

中文字日产幕乱无广告黄页网址大全免费www8899www明星换脸区二区免费播放永久永久地址链接链接链接链接