Home > Web Front-end > JS Tutorial > body text

layer Get page layer (type:1) element method

一个新手
Release: 2017-09-21 10:23:43
Original
6437 people have browsed it


   $('#refuse').on('click',function () {
        layer.open({
           type:1,
           area:['500px','300px'],
           content:$('#refusep').html(),
            shadeClose:true,
            btn:['确认','取消'],
            title:'审核拒绝',
            yes:function (index,layero) {//index 为当前页面索引,layero 为当前页面的DOM,所以可以利用下面的方式获取
                $.ajax({
                    url:&#39;<%=contextPath%>/doctor/refuseApply&#39;,
                    type:&#39;post&#39;,
                    dataType:&#39;json&#39;,
                    contentType:&#39;application/json&#39;,
                    data:                      JSON.stringify({
                          id:$("#userId").val(),//获取的内容                          
                          reason:$(layero).find(&#39;textarea[name=reason]&#39;).val(),
                          state:3
                      })
                    ,
                    success:function (data) {
                        if (data.code==&#39;200&#39;){

                            layer.msg("审核成功");
                            layer.close(index);                            
                            var index1 = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index1); //再执行关闭
                        }                        else
                            layer.msg("审核失败");

                    },
                    error:function (data) {
                        layer.msg("审核失败");
                    }
                });
            },
            cancel:function (index,layero) {
                layui.layer.close(index);
            }

        });
    });
Copy after login

The above is to pop up the page layer again based on a pop-up iframe layer, to obtain the content entered in textarea

The above is the detailed content of layer Get page layer (type:1) element method. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!