在队列中的.load之后,我遇到了让动画工作的问题。我不太熟悉.queue函数,但在本例中,.post写入一个页面,我必须等待一段时间,等待它更新mysql数据库,因此才会有.delay和.load的.queue。#current_question目录位于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);
});发布于 2014-09-16 21:41:14
如果你发布一些东西到一个脚本,我猜这个脚本会写到数据库中?如果是这样的话:为什么不返回新的超文本标记语言并等待.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来提供一个作用域,使其不会干扰您当前存在的变量。
https://stackoverflow.com/questions/25870044
复制相似问题