我有一个使用jQTools overlay和jQuery .ajax提交例程的表单。一旦显示成功/错误消息,我希望覆盖关闭。如何将setTimeout合并到此中(仅在显示成功/错误消息后)叠加的ID为“#overlayForm”
$.ajax({
type: $(form).attr('method'),
url: form.action,
data: dataString,
clearForm: true,
success: function (data) {
if (data == "Mail sent") {
$("#formWrap, #supportHdln").hide();
$("#thankYou").html('<h2><span>Thank You | </span>We have received your request.</h2><p>A Customer Service Representative from Kinetick will contact you shortly</p>').fadeIn("slow");
} else {
$("#formWrap, #supportHdln").hide();
$("#error").html('<h2"><span>Uh Oh | </span>We have encountered an error in your submission.</h2><p> Please check that all required form fields were filled out, if that does not resolve the issue, please <a href="mailto:support@kinetick.com?subject=Cancelling Kinetick Account Help">email</a> us here.</p>').fadeIn("slow");
}
}
});
return false;
}
答案 0 :(得分:1)
我认为最简单的一个是匿名函数:
setTimeout(function(){$("#overlayForm").hide();},1000);
我查看了Jquery Tools的文档,我想你必须谈谈这个:
http://flowplayer.org/tools/overlay/index.html
他们谈论“关闭()”。
那就是:
$("#overlayForm").close();