将表单提交到新标签并关闭模式

时间:2013-08-28 16:34:11

标签: php javascript jquery forms

我正在从模态窗口向新标签页提交表单。我想要提交表单,关闭模式,以及要刷新的模态的父级。新选项卡打开正常,模式不会关闭。我在模式php脚本中使用相同的js,RefWin()作为最后一行,当脚本结束时,模态关闭,父模式刷新。模态窗口是一个jquery插件,我确实想使用javascript来关闭模态。我试图使用onsubmit和onclick,但都没有工作。我知道有一个简单的答案,我很难过......感谢一些帮助。

<script>

    function reloadSource() {
    var p_ref=parent.location.href;
    parent.location.href=(p_ref);
    }

    function RefWin() {
    window.open('', '_self', '');
    window.close();
    reloadSource();
    }

</script>


<form action="https://www.paygate.com/p/" method="POST" target="_new" onsubmit="RefWin();">

<input type="text" name="v1" maxlength="200" value="100.00" />


<input type="text" name="v2" maxlength="200" value="Software" />

<input type="image" name="submit" src="http://www.myurl.com/img/paybutton.gif" border="0" />

</form>

1 个答案:

答案 0 :(得分:1)

也许尝试使用     $('.modal').remove(); 其中'.modal'是你的模态的类