zoukankan      html  css  js  c++  java
  • jquery Jbox 插件实现弹出窗口在修改的数据之后,关闭弹出窗口刷新父页面的问题

    http://blog.csdn.net/nsdnresponsibility/article/details/51282797

    问题如题:
    这里我们在父页面定义一个全局的变量来标识是否需要刷新父页面(声明:下图中点击保存页面之后,不关闭子页面):点击1出弹出窗口:
    这里写图片描述
    我们的目的是:如果,用户保存过数据:在点击关闭按钮和2处所指的小X时,刷新父列表页面;若果用户没有保存过数据,关闭窗口是不刷新父列表页面。

    //这里是父页面(列表页面)
    var isFreshFlag="1";<%--关闭修改窗口时是否刷新列表页面标识,1:不刷新。2:刷新--%>
    <%--新增窗口--%>
    function addTradeProject(id){
        isFreshFlag="1";
        jBox.open(
            "iframe:${ctx}/xxxController/goXXX.html?id="+id, 
            "新增", 800, 500, 
            {id:'addTradeProject', buttons: {}, iframeScrolling: 'yes', showClose: true,
                closed:function (){
                    //在弹出窗口页面,如果我们保存了数据,就将父页面里的变量isFreshFlag 值设置为2
                    if(isFreshFlag==2){
                        location.reload();
                    }
                }
            }
        );
    }

    弹出窗口页面的保存方法:

    function doSave() {
            $.ajax({
                type:"post",
                url:"${ctx}/xxxController/saveXxx.html",
                data:$("#formId").serialize(),
                dataType:"json",
                success:function(data){
                    if(data.result > 0){
                        alert("保存成功!");
                        hideLock("#listlist");
                        window.parent.window.isFreshFlag="2";//回写父页面的值
                        //刷新当前页
                        location.reload();
                    }else{
                        alert("保存失败,请联系管理员");
                    }
                }
            });
    
        }
     
  • 相关阅读:
    Security and Cryptography in Python
    Security and Cryptography in Python
    Security and Cryptography in Python
    Security and Cryptography in Python
    Security and Cryptography in Python
    Security and Cryptography in Python
    Security and Cryptography in Python
    微信小程序TodoList
    C语言88案例-找出数列中的最大值和最小值
    C语言88案例-使用指针的指针输出字符串
  • 原文地址:https://www.cnblogs.com/antis/p/6958641.html
Copyright © 2011-2022 走看看