jQuery 处理程序错误不是函数 [英] jQuery Handler error is not a function
本文介绍了jQuery 处理程序错误不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 jquery ajax 文件上传.该文件已正确上传,但我收到类似
I am using jquery ajax fileupload. the file is uploaded correctkly but i got error like
TypeError: jQuery.handleError is not a function
[Break On This Error]
jQuery.handleError(s, xml, status, e);
使用jQuery 1.7.2版本,代码为
using jQuery version 1.7.2 and the code is
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() 也没有执行.
the function showprofilepicture() also not excuted.
推荐答案
jQuery.handleError 在 1.5 之后的 jQuery 版本被移除了,你需要编写一个自定义的错误处理函数来解决这个问题
The jQuery.handleError was removed after the jQuery version in 1.5 you need to write a custom error handler function to solve this like
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);
}
});
Refer from the blog. Thanks John Main for your information
这篇关于jQuery 处理程序错误不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文