php 提交表单 关闭layer弹窗iframe的实例讲解

介绍一款非常好用的前端弹窗插件

layer 官网地址:nofollow" target="_blank" href="http://layer.layui.com/">http://layer.layui.com/

根据官方的API:layer的iframe弹窗

rush:PHP;"> //iframe层-父子操作 layer.open({ type: 2,area: ['700px','530px'],fix: false,//不固定 maxmin: true,content: 'test/iframe.html' });

这里以PHP开发为例 演示如何 提交表单后自动关闭layer弹窗

(1)弹出layer编辑框 :

rush:PHP;"> function edit(id){ if(id==null||id==''||id=='undefined'){ alert('操作编号为空,请联系管理员'); }

layer.open({
type: 2,//不固定
maxmin: true,content: 'index.PHP?m=content&c=meiti&a=edit_paiqi&id='+id
});
}

(2)编辑页面主要代码

rush:PHP;">

(3)PHP后台保存数据并指向一个关闭layer窗口的方法

update($insertinfo,array("id"=>$id)); if($datas){ 关闭窗口方法 } }else{ $datas = $paiqi_db->select(array("id"=>$id)); $template = "edit_config_paiqi"; include $this->admin_tpl($template); } }
admin_tpl($template); }

(4)关闭窗口并刷新父窗口页面的关键代码

rush:PHP;"> $(function(){ parent.location.reload();//刷新父窗口 parent.layer.closeAll();//关闭所有layer窗口 });

注意:

页面需要加载layer需要的js库才能使用layer方法

以上这篇PHP 提交表单 关闭layer弹窗iframe的实例讲解就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持编程之家。

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...