最近使用ajaxfileupload插件上传文件时,后台正常运行时,可以正常使用;当后台出现异常时,上传后没有任何反应,也无任何返回信息,使用chrome查看时,发现ajaxfileupload插件报错,信息如下:"Uncaught TypeError: Object function (a,b){return new e.fn.init(a,b,h)} has no method 'handleError'"。

经过在网上搜索答案,发现是由于JQuery在1.5版本后就废除了handleError方法,因此需要在ajaxfileupload中自己添加handleError方法,方法如下:

handleError: function( s, xhr, status, e ) {
    // If a local callback was specified, fire it
    if ( s.error ) {
        s.error.call( s.context || window, xhr, status, e );
    }

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

 

相关文章:

  • 2021-12-26
猜你喜欢
  • 2021-04-16
  • 2021-11-20
  • 2021-10-22
  • 2021-06-28
  • 2022-12-23
  • 2022-12-23
  • 2022-01-18
相关资源
相似解决方案