jQuery Handler错误不是一个函数

我正在使用jquery ajax fileupload 。 该文件正确上传,但我得到了错误

TypeError: jQuery.handleError is not a function [Break On This Error] jQuery.handleError(s, xml, status, e); 

使用jQuery版本1.7.2和代码是

 jQuery.ajaxFileUpload ( { url:'', secureuri:false, fileElementId:'fileToUpload', dataType: 'json', data:{'image_desc':image_desc,'gallery_id':curr_time_stamp}, success: function (data, status) { if(typeof(data.error) != 'undefined') { if(data.error != '') { alert(data.error); }else { alert(data.msg); showprofilepicture(); } } } } ) 

函数showprofilepicture()也没有被执行。

在1.5中的jQuery版本之后删除了jQuery.handleError,你需要编写一个自定义error handling函数来解决这个问题

 jQuery.extend({ 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 (eg from an AJAX call) then log it in the console else if(xhr.responseText) console.log(xhr.responseText); } }); 

请参阅博客 。 感谢John Main提供的信息

  if(typeof(data.error) != 'undefined') { if(data.error != '') { alert(data.error); }else { alert(data.msg); showprofilepicture(); } } 

应该

 jQuery.ajaxFileUpload({ url:'', secureuri:false, fileElementId:'fileToUpload', dataType: 'json', data:{'image_desc':image_desc,'gallery_id':curr_time_stamp}, success: function (data, status) { if(typeof(data.error) != 'undefined') { if(data.error != '') { alert(data.error); } }else { alert(data.msg); showprofilepicture(); } } } )