您的位置:首页 > Web前端 > JavaScript

用 ajaxFileUpload 出现的问题:has no method 'handleError'、返回json数据提示下载

2013-11-20 12:14 826 查看
1. 提示错误:Uncaught TypeError: Object function (a,b){return new d.fn.init(a,b,g)} has no method 'handleError'

目前找到两种情况会出现这个错误:

(1)、url地址没访问到

(2)、$.ajaxFileUpload中的dataType的值为小写,只需要把只该成大写就ok了。比如dataType : 'JSON'

jQuery.handleError is not a function 原因是handlerError只在jquery-1.4.2之前的版本中存在,jquery-1.6 和1.7中都没有这个函数了,因此在1.4.2中将这个函数复制到了ajaxFileUpload.js中,问题解决
handleError: function( s, xhr, status, e ) 		{
// If a local callback was specified, fire it
if ( s.error ) {
s.error.call( s.context || s, xhr, status, e );
}

// Fire the global callback
if ( s.global ) {
(s.context ? jQuery(s.context) : jQuery.event).trigger( "ajaxError", [xhr, s, e] );
}
},


2.返回json数据在ie下提示下载

解决方法:

设置content-type为text/html或plain/text
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐