jQuery Handler错误不是函数 [英] jQuery Handler error is not a function
本文介绍了jQuery Handler错误不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用jquery ajax fileupload .该文件正确上传,但出现类似
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版本1.5之后,删除了jQuery.handleError,您需要编写一个自定义错误处理函数来解决此问题
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 Handler错误不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文