使用ajaxfileupload插件提示Uncaught TypeError:has no method 'handleError'
2013-11-25 12:29
603 查看
最近使用ajaxfileupload插件上传文件时,后台正常运行时,可以正常使用;当后台出现异常时,上传后没有任何反应,也无任何返回信息,使用chrome查看时,发现ajaxfileupload插件报错,信息如下:"Uncaught
TypeError: Object function (a,b){return new e.fn.init(a,b,h)} has no method 'handleError'"。
经过在网上搜索答案,发现是由于JQuery在1.5版本后就废除了handleError方法,因此需要在ajaxfileupload中自己添加handleError方法,方法如下:
handleError: function( s, xhr, status, e ) {
// If a local callback was specified, fire it
if ( s.error ) {
s.error.call( s.context || window, xhr, status, e );
}
// Fire the global callback
if ( s.global ) {
(s.context ? jQuery(s.context) : jQuery.event).trigger( "ajaxError", [xhr, s, e] );
}
}
增加handleError方法后,上传正常,后台发生异常时,可正常捕捉错误进行响应。
TypeError: Object function (a,b){return new e.fn.init(a,b,h)} has no method 'handleError'"。
经过在网上搜索答案,发现是由于JQuery在1.5版本后就废除了handleError方法,因此需要在ajaxfileupload中自己添加handleError方法,方法如下:
handleError: function( s, xhr, status, e ) {
// If a local callback was specified, fire it
if ( s.error ) {
s.error.call( s.context || window, xhr, status, e );
}
// Fire the global callback
if ( s.global ) {
(s.context ? jQuery(s.context) : jQuery.event).trigger( "ajaxError", [xhr, s, e] );
}
}
增加handleError方法后,上传正常,后台发生异常时,可正常捕捉错误进行响应。
相关文章推荐
- 使用ajaxfileupload插件提示Uncaught TypeError:has no method 'handleError'
- 当使用JQuery的"$",抛异常Uncaught TypeError: Object #<Object> has no method 'ajax'
- jQuery File upload, Uncaught TypeError: Object function ... ... has no method 'widget'
- jquery file upload报错 TypeError: Object [object Object] has no method 'progressbar'
- 用 ajaxFileUpload 出现的问题:has no method 'handleError'、返回json数据提示下载 、一直返回error
- 用 ajaxFileUpload 出现的问题:has no method 'handleError'、返回json数据提示下载
- jquery dialog异常 Uncaught TypeError: Object [object Object] has no method 'dialog'
- android中java和JS互相调用,Web Console: Uncaught TypeError: Object [object Object] has no method
- WebView注入Java对象注意事项 [INFO:CONSOLE(475)] "Uncaught TypeError: Object [object Object] has no method
- js调用java方法的遇到的坑Uncaught TypeError: Object [object Object] has no method
- [Android] Web Console: Uncaught TypeError: Object [object Object] has no method 'xxx'
- Android js交互错误:Uncaught TypeError: Object [object Object] has no method 'xxx'
- 安卓WebView报错:android uncaught typeerror object object object has no method
- Android webview js 调用java方法报错"Uncaught TypeError: Object [object Object] has no method xx
- Uncaught TypeError: Object [object Object] has no method 'highcharts'
- ajaxfileupload.js结合低版本jquery报异常:TypeError: jQuery.handleError is not a function
- Struts2 使用ajax访问action,返回json格式数据,提示error:There is no result type defined for type 'json'
- Uncaught TypeError: Object #<Object> has no method 'addEvents'
- 【Android】Web Console: Uncaught TypeError: Object [object Object] has no method 'xxx'
- Uncaught TypeError: Object [object Object] has no method 'live' 报错