php - Ajax 上传插件抛出 jQuery.handleError not found

标签 php jquery ajax

我正在使用来自 PHP Letter 的 ajax 文件上传插件并且正在使用 jQuery 1.6.2。文件上传正确,但无法使用从 php 脚本返回的 JSON 数据,当我检查 javascript 错误控制台时,我是否遇到了这个错误,

"Uncaught TypeError: Object function (a,b){return new e.fn.init(a,b,h)} has no method 'handleError'"

在 chrome 和

"jQuery.handleError is not a function"

在火狐中。

有没有人有类似的经历?

最佳答案

当您尝试将它与最新版本的 jQuery 一起使用时。 handleError 函数从高于 V 1.5 的库中贬值。 我通过在我的 ajaxfileupload.js 文件中添加这个函数来解决它。

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

对我来说效果很好。 此外,如果您尝试在同一页面上使用任何 ajaxSubmit(),它将无法正常工作,因此我使用带有 ajxfileupload 的普通表单提交。如果有人能以同样的方式提供帮助,请告诉我。

关于php - Ajax 上传插件抛出 jQuery.handleError not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8627201/

相关文章:

javascript - 一个浏览器窗口中有两个 Web 应用程序 - 一个不需要刷新,而第二个需要刷新

php - 如何知道我的帖子请求来自 PHP 服务器中的 phonegap/cordova 应用程序

php - 使用 Codeigniter Mysql 进行实时搜索

php - 无法在第 21 行 fatal error 上打开流 wp-settings.php

javascript - 两个 Onclick 函数,ajax/php 或 JS。首先调用什么?

javascript - ajax从php导入json内容到edge animate

javascript - 如何并排显示三个子表?

php - 根据 ID 列表与 Eloquent 进行连接

带表格排序器的 PHP、MYSQL、HTML 表格

javascript - AJAX POST 上的 Django [WinError 10053]