Jbox 父页面 获取 子页面 form 数据 并提交到后台

来源:互联网 发布:网络信息安全重大事件 编辑:程序博客网 时间:2024/05/17 23:25

Jbox 父页面 获取 子页面 form 数据 并提交到后台


父页面

function addNew(dept){        top.$.jBox.open("iframe:${ctx}/bus/busPeopleParty/form?createDept="+dept,"新增村委成员", 1150, 500, {            buttons:{"确认":"ok", "关闭":true},            submit:function(v, h, f){                if(v=="ok"){                    var data=h.find("iframe")[0].contentWindow.$("#inputForm").serialize();                    var url = "${ctx}/bus/busPeopleParty/ajaxSave";                    $.ajax({                        type: 'POST',                        url : url,                        data: data,             //获取表单数据                        success : function(data) {                            if (data.result) {                                alert("保存成功");                                window.parent.page();                 //调用父窗体方法,当关闭子窗体刷新父窗体                                window.parent.window.jBox.close();    //关闭子窗体                            } else {                                alert("保存失败:"+data.message);                                window.parent.page();                                window.parent.window.jBox.close();                            }                        }                    });                    self.location.reload(); // 主窗口刷新                  }            },            loaded:function(h){                $(".jbox-content", top.document).css("overflow-y","hidden");            }        });    }

子页面

<form:form id="inputForm" modelAttribute="busPeopleParty" action="${ctx}/bus/busPeopleParty/save" method="post" class="form-horizontal">    <form:hidden path="id"/>    <input style="display:none;" id="dept" type="text" name="dept" value="${param.createDept}" />    <sys:message content="${message}"/>            <div class="control-group">        <label class="control-label">编号:</label>        <div class="controls">            <form:input path="code" htmlEscape="false" maxlength="255" class="input-xlarge "/>        </div>    </div>    <div class="control-group">        <label class="control-label">组:</label>        <div class="controls">            <form:input path="groups" htmlEscape="false" maxlength="255" class="input-xlarge "/>        </div>    </div>    <div class="control-group">        <label class="control-label">备注信息:</label>        <div class="controls">            <form:textarea path="remarks" htmlEscape="false" rows="4" maxlength="255" class="input-xxlarge "/>        </div>    </div>    <div class="control-group">        <label class="control-label">父级编号:</label>        <div class="controls">        </div>    </div>    <div class="control-group">        <label class="control-label">是否村委成员:</label>        <div class="controls">            <form:input path="inParty" htmlEscape="false" maxlength="255" class="input-xlarge "/>        </div>    </div></form:form>

Jbox QQ 交流群 621031233

原创粉丝点击