【发布时间】:2012-01-14 08:29:15
【问题描述】:
现在我有一个用户输入信息的表单。它比处理 bu jQuery ajax 函数并设置为 return false; 因此在用户提交表单后不会发生页面重新加载。
虽然我需要重新加载页面,但如果我删除 return false; 它会在显示成功消息之前刷新页面(此消息在用户提交数据后显示)。
$.ajax({
type: "POST",
url: "scripts/process.php",
data: dataString,
success: function() {
$("#st_message").html("<p> Your article was successfully added!</p>");
//I need to reload page after the above message is shown
}
});
return false;
那么我如何在显示<p> Your article was successfully added!</p> 消息后重新加载页面,稍微延迟 2 到 3 秒,这样用户才能真正阅读消息。
【问题讨论】: