修改前,会之间跳转不做停留
$(‘.del_digest‘).click(function(){
var id = $(this).attr(‘data‘);
layer.confirm("确定要删除数据吗?",
{btn:["确定","取消"]},
function () {
$.get("{:U(MODULE_NAME.‘/Digest/delDigest/id/"+id+"‘)}",function(date){
if(date.status==1){
window.location.reload();
layer.msg(data.msg,{time:1000,icon: 6});
}else{
layer.msg(date.msg,{time: 2000, icon:6});
}
},‘JSON‘);
},function () {
});
})
修改后,调用回调函数
$(‘.del_digest‘).click(function(){
var id = $(this).attr(‘data‘);
layer.confirm("确定要删除数据吗?",
{btn:["确定","取消"]},
function () {
$.get("{:U(MODULE_NAME.‘/Digest/delDigest/id/"+id+"‘)}",function(date){
if(date.status==1){
layer.msg(date.msg,{time: 1000, icon:6,end:function(){
window.location.reload();}});
}else{
layer.msg(date.msg,{time: 2000, icon:6});
}
},‘JSON‘);
},function () {
});
})
原文:http://www.cnblogs.com/RZZG/p/7799154.html