【发布时间】:2012-10-11 22:42:11
【问题描述】:
我在使用 jQuery 的 ajax 函数时总是报错:
Uncaught TypeError: Object # has no method 'done'
让我感到困惑的是,它在过去 3 天里运行良好。而且我做了一些更改,所以我想这一定是我的错,但它没有返回语法错误,就像它告诉我 jquery ajax 函数错误一样,那不可能?
$.ajax({
type: "POST",
url: "ajax/cms.php",
data: {
job: 'edit_staff',
id: id,
name: staff_name,
description: staff_description
}
}).done(function(returned)
{
var message =
$('<div class = "edit_status_message_fees">' + '<span>Success: </span>' + returned + '</div>');
message.appendTo('.edit_team');
$('.edit_status_message_fees')
.fadeIn('normal',
function()
{
if(returned == "Database updated!")
{
$.post('ajax/get_new_staff_details.php', function(new_team)
{
$('.theteam').html(new_team); // Update main content area
});
$('.edit_team')
.delay('500')
.fadeOut('normal', function()
{
$('.edit_team').remove();
})
$('.list_team')
.delay('500')
.fadeOut('normal', function()
{
$('.list_team').remove();
})
$('.edit_cover')
.delay('500')
.fadeOut('normal', function()
{
$('.edit_team').remove();
})
}
})
}); // END ajax
有人可以帮帮我吗?
【问题讨论】:
-
所有浏览器都会出现这种情况,还是只出现在 IE 中?
-
另外,as mentioned here,请确保您使用的是 1.5 或更高版本的 jQuery。