Javascript 表单提交成功时的ajax页面刷新
我正在使用此ajax代码提交表单Javascript 表单提交成功时的ajax页面刷新,javascript,php,jquery,ajax,Javascript,Php,Jquery,Ajax,我正在使用此ajax代码提交表单 <script type="text/javascript"> $(document).ready(function(){ $("#ticketupdate_message").hide(); $("#ticketupdate_please_wait_box").hide(); $("#ticket_update").submit(function(e){ $("#ticketupdate_message").hide(); $("#
<script type="text/javascript">
$(document).ready(function(){
$("#ticketupdate_message").hide();
$("#ticketupdate_please_wait_box").hide();
$("#ticket_update").submit(function(e){
$("#ticketupdate_message").hide();
$("#ticketupdate_please_wait_box").show();
e.preventDefault();
dataString=$("#ticket_update").serialize();
$.ajax({
type: "POST",
url: "reviewtickets_history.php?seq=<?php echo $_GET["seq"]; ?>",
cache: false,
data: dataString,
success: function(res){
$("#ticketupdate_please_wait_box").hide();
$("#ticketupdate_message").html(res);
$('#ticketupdate_message').fadeIn('slow');
$('.overlay').fadeOut();
if(res.indexOf("success")!=-1)
{
window.location.href = res.substr(8);
}
else
{
$("#ticket_update")[0].reset();
}
}
});
});
});
</script>
$(文档).ready(函数(){
$(“#ticketupdate_message”).hide();
$(“#ticketupdate_please_wait_box”).hide();
$(“#票证更新”)。提交(功能(e){
$(“#ticketupdate_message”).hide();
$(“#ticketupdate_please_wait_box”).show();
e、 预防默认值();
dataString=$(“#票证更新”).serialize();
$.ajax({
类型:“POST”,
url:“reviewtickets_history.php?seq=”,
cache:false,
数据:dataString,
成功:功能(res){
$(“#ticketupdate_please_wait_box”).hide();
$(“#ticketupdate_message”).html(res);
$('ticketupdate'u message').fadeIn('slow');
$('.overlay').fadeOut();
如果(res.indexOf(“success”)!=-1)
{
window.location.href=res.substr(8);
}
其他的
{
$(“#票证更新”)[0]。重置();
}
}
});
});
});
如果页面刷新成功,如何添加页面刷新?使用location.reload()
以重新加载页面
if(res.indexOf("success")!=-1)
{
location.reload();
}
请参阅:使用
location.reload()
:
如果要覆盖缓存,请添加true
参数:location.reload(true)代码>
干杯您可以使用location.reload()
如果重新加载页面,则在成功
回调中执行的所有其他操作有什么意义?其他操作将不在那里,我将在重新加载页面时删除它们刷新页面将在成功处理程序中取消对页面所做的任何更改。。。
if(res.indexOf("success")!=-1)
{
location.reload();
}