为了使用jquery提交后,能在当前页面显示返回信息,又能改变页面,就需要局部刷新了
比如要刷新一个<table id="table"></table>表
这是一段在ThinkPHP上用的代码:
$('#checkChange').on('click',function(){
$.post("{:U('order/changeState')}",{id:id,action:'change'},function(responseText){
$('#changeState').modal('hide');
$('#output').html('<div class="alert alert-info"><button type="button" class="close" data-dismiss="alert">×</button><strong>操作提示</strong> '+responseText.info+'</div>');
$("#table").load(location.href+" #table"); //重点在这,其它就不列出来 了!
setTimeout("location.reload()",2000);
});
});