父页面 js:
//$that为要绑定事件的jquery变量
$that.on('click', function () {
layer.open({
title: '医生认证审核',
type: 2,
content: '<%=staticPath%>/doctor/toDoctorReview/'+id,
area: ['800px', '500px'],
shadeClose: true,
btn:['关闭'],
success:function (data) {
$.ajax({
url:'<%=staticPath%>/doctor/changeLockStateReview',
type:'post',
data:JSON.stringify({
id:id,
isLock:1,
state:4
}),
dataType:'json',
contentType:'application/json',
success:function (result) {
if(result.code==200)
layer.msg("状态更新成功");
else
layer.msg("状态更新失败");
},
error:function (result) {
layer.msg("状态更新失败");
}
});
},//关闭弹层时会调刷新本页面
end:function (index) {
location.reload(true);
}
});
});
弹出层:
$('#agree').on('click',function () {
$.ajax({
url:'<%=contextPath%>/doctor/agreeApply/'+$("#userId").val(),
type:'get',
dataType:'json',
// contentType:'application/json',
success:function (data) {
if (data.code=='200'){
layer.msg("审核成功");
//关闭动作的关键代码
//假设这是iframe页
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
parent.layer.close(index); //再执行关闭
}
else
layer.msg("审核失败");
},
error:function (data) {
layer.msg("审核失败");
}
});
});
在 layer文档http://www.layui.com/doc/modules/layer.html 也能找到