我无法让动画在队列中加载.load。我不太熟悉.queue函数,但在这种情况下,.post会写入一个页面,我必须稍等一下才能更新mysql数据库,因此.delay和.queue为.load。 #current_question div位于it.jsp页面内,这似乎导致了所有问题。也许我做错了,无论#current_questions动画没有加载。
请帮助黑客让它正常工作!感谢。
$.post("it.jsp",
{
fail: "1"
}
);
$('#current_question').fadeOut(300);
$('#it_refresh').delay(500).queue(function(next) {
$('#it_refresh').on().load('it.jsp');
next();
$('#current_question').hide();
$('#current_question').fadeIn(1000);
});
答案 0 :(得分:0)
如果您将某些内容发布到脚本中,我猜该脚本会写入数据库吗?如果是这样:为什么不返回新的HTML并等待.post
回调?
(function(){
var $currentQuestion = $('#current_question'),
$itRefresh = $('#it_refresh');
$currentQuestion.fadeOut(300);
$.post('it.jsp',{fail: "1"}, function(response) {
$itRefresh.html(response);
$currentQuestion.fadeIn(1000);
});
})();
我添加了一个IIFE,以提供不会干扰您当前存在的变量的范围。