JQuery handler error is not a function

I am using jquery ajax fileupload . file uploaded correctkly but i got an error like

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

using jQuery version 1.7.2, and the code

 jQuery.ajaxFileUpload ( { url:'<?php echo $currenturl.'&fileupload=enable';?>', 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(); } } } } ) 

the showprofilepicture () function is also possible.

+6
source share
2 answers

jQuery.handleError was removed after jQuery version 1.5, you need to write your own error handler function to solve this problem, for example

 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); } }); 

Refer to the blog . Thanks John Main for your information.

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

it should be

 jQuery.ajaxFileUpload({ url:'<?php echo $currenturl."&fileupload=enable";?>', 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(); } } } ) 
0
source

All Articles