jQuery、layer实现弹出层的打开、关闭功能
打开弹出层:
在list页面带入layer.js
在list页面点击时,弹出form弹出层,list.js:
$(".add_category,.update").click(function(){ //弹出框 var doMain = $('.domain_name').val(); layer.open({ shade: [0.5, '#000', false], type: 2, area: ['900px', '530px'], fix: false, //不固定 maxmin: true, title: ['添加或修改用户类型', false], content: doMain+"/Stat/QueryUserCategoryForm.action?adminUserCategory.id="+$(this).val() }); });
在点击form弹出层的“保存”按钮时,如果保存数据成功,则关闭弹出层,并且刷新list页面:
<span style="color:#000099;">submitHandler: function (form){ $.post( $('.domain_name').val()+"/Stat/AddOrUpdateUserCategory.action", $(form).serialize(), function(data){ var result = eval("("+data+")"); if(!result.status){ alert(result.message); }else{ //添加数据成功,关闭弹出窗之前,刷新列表页面的数据 parent.window.location.href=$('.domain_name').val()+"/Stat/QueryUserCategoryListStat.action"; </span><span style="color:#ff6666;"> var index = parent.layer.getFrameIndex(window.name); //获取窗口索引 parent.layer.close(index); </span><span style="color:#000099;"> } } ); } </span>
相关推荐
EdwardSiCong 2020-11-23
85477104 2020-11-17
hhanbj 2020-11-17
81427005 2020-11-11
seoppt 2020-09-13
honeyth 2020-09-13
WRITEFORSHARE 2020-09-13
84483065 2020-09-11
momode 2020-09-11
85477104 2020-08-15
83510998 2020-08-08
82550495 2020-08-03
tthappyer 2020-08-03
84901334 2020-07-28
tthappyer 2020-07-25
TONIYH 2020-07-22
tztzyzyz 2020-07-20
83510998 2020-07-18
81463166 2020-07-17