请知悉:本文最近一次更新为 9年 前,文中内容可能已经过时。

jQuery.handleError is not a function 报错原因是:

  1. handlerError只在jQuery-1.4.2之前的版本中存在,jQuery-1.4.2之后的版本中都没有这个函数了。
  2. 如果返回的dataType: “json”, 是json格式的,则还需要添加httpData方法。

以上原因整理自:https://www.fangsi.net/archives/772.html

解决办法,直接在源码的uploadHttpData方法后添加兼容代码即可:

    uploadHttpData: function( r, type ) {
var data = !type;
data = type == "xml" || data r.responseXML : r.responseText;
// If the type is "script", eval it in global context
if ( type == "script" )
jQuery.globalEval( data );
// Get the JavaScript object, if JSON is used.
if ( type == "json" )
eval( "data = " + data );
// evaluate scripts within html
if ( type == "html" )
jQuery("<div>").html(data).evalScripts();
return data;
},handleError: function( s, xhr, status, e ) {
// If a local callback was specified, fire it
if ( s.error )
s.error( xhr, status, e );
// If we have some XML response text (e.g. from an AJAX call) then log it in the console
else if(xhr.responseText)
console.log(xhr.responseText);
}

源文件代码过多,就不贴到博客了,有需要的同学自己下载对比:


如您从本文得到了有价值的信息或帮助,请考虑扫描文末二维码捐赠和鼓励。

本站资源,请 注册城通账户 后,使用客户端下载,参考教程:城通网盘如何使用客户端下载文件


尊重他人劳动成果。转载请务必附上原文链接,我将感激不尽。


与《ajaxfileupload-jQuery.handleError is not a function修复办法》相关的博文:


留言

avatar
😀
😀😁😂😅😭🤭😋😘🤔😰😱🤪💪👍👎🤝🌹👌