首页 > 技术文章 > ajax模态窗口

htbmvc 2017-11-22 19:31 原文

function showAdd() {
layer.open({
type: 2,
shade: 0.5,
title: false, //不显示标题
area: ['800px', '600px'],
content: "/student/addinsert",
//success: function (data) {
// if (data == "ok") {
// //成功后关闭自身
// var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
// parent.layer.close(index); //再执行关闭
// location.href = '/student/Index'
// } else {
// layer.alert('添加失败')
// }
//}
})
}

 

///关闭页面

$("form").submit({
success: function (data) {
if (data == "ok") {
//成功后关闭自身
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
parent.layer.close(index); //再执行关闭
location.href = '/student/Index'
} else {
layer.alert('添加失败')
}
}
});

推荐阅读