2012-10-28 30 views
6

मैं jquery AJAX fileupload का उपयोग कर रहा हूं। फ़ाइल correctkly अपलोड की गई है, लेकिन मैंjQuery हैंडलर त्रुटि एक फ़ंक्शन नहीं है

TypeError: jQuery.handleError is not a function 
[Break On This Error] 

jQuery.handleError(s, xml, status, e); 

तरह त्रुटि मिली jQuery संस्करण 1.7.2 का उपयोग करने और कोड

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

      } 
     ) 

समारोह showprofilepicture() भी excuted नहीं है।

उत्तर

22

jQuery.handleError 1.5 में jQuery संस्करण के बाद हटा दिया गया था आप को हल करने के इस तरह

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

से देखें एक कस्टम त्रुटि हैंडलर समारोह लिखने की ज़रूरत blog। धन्यवाद आपकी जानकारी के लिए जॉन मेन

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

होना चाहिए

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

मैंने इसे बदल दिया लेकिन यह काम नहीं कर रहा है अगर मैं इससे पहले एक चेतावनी डालता हूं लेकिन अलर्ट काम नहीं कर रहा है – jackyesind

संबंधित मुद्दे