国产精品亚洲综合色拍,人人干人人爱,中文字幕专区在线亚洲,清纯唯美激情视频二区

首頁 服務 產(chǎn)品 文檔 關于

jQuery.handleError is not a function錯誤

handlerError只在jQuery-1.4.2之前的版本中存在,jQuery-1.4.2之后的版本中都沒有這個函數(shù)了

所以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;
? ? }
});