ajaxFileUpload 报这错jQuery.handleError is not a function
现在大家至少也在用jquery1.9以上的版本,ajaxfileupload的版本早就不更新了,大家可以下载看:地址这里,它例子里使用的Jquery是1.2的,好老呀。。。这个问题,我以前开发过程中遇过,网上说经测试(我是没测试),是版本1.4.2之前的版本才有handlerError方法,之后就不存在了,(你存在,我深深的脑海里。。。),为了能够继续使用ajaxfileupload上传我们的附件,只好将代码拷进我们的项目中的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] );
}
}
---- ajaxfileupload.js文件 ----
jQuery.extend({
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] );
}
},
createUploadIframe: function(id, uri)
{
//create frame
var frameId = 'jUploadFrame' + id;
if(window.ActiveXObject) {
var io = document.createElement('<iframe ).html(data).evalScripts();
//alert($('param', data).each(function(){alert($(this).attr('value'));}));
return data;
}
})