layui 中弹窗的时候关闭当前页面并刷新

var index=parent.layer.getFrameIndex(window.name); //获取当前窗口的name
        parent.layer.close(index);//关闭当前窗口
window.parent.location.reload();//刷新


例子:==========================================

layui.use(['jquery','form','layer'], function(){
var $ = layui.jquery,
layer = layui.layer,
form = layui.form;
form.on('submit(tijiao)', function(data){
$.ajax({
url:'/users/updateUser',
data:data.field,
type:"Post",
dataType:"json",
success:function(data){
var index=parent.layer.getFrameIndex(window.name); //获取当前窗口的name
parent.layer.close(index);
window.parent.location.reload();
},
error:function(data){
$.messager.alert('错误',data.msg);
}
});
return false;
});
})


posted on 2020-07-07 16:50  songyinan  阅读(2195)  评论(0编辑  收藏  举报