Wednesday, 28 August 2013

submit form to new tab and close modal

submit form to new tab and close modal

I am submitting a form to a new tab from a modal window. I want the form
to submit, the modal to close, and the parent of the modal to refresh. The
new tab opens fine and the modal does not close. I am using this same js
in a modal php script with RefWin() as the last line and when the script
ends, the modal closes and the parent refreshes. The modal window is a
jquery plugin and I do want to use javascript to close the modal. I have
attempted using onsubmit and onclick and neither work. I know there is a
simple answer to this and I am stumped... appreciate some assistance.
<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.paymentgate.com/process/" method="POST"
target="_new">
<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"
onsubmit="RefWin();" />
</form>

No comments:

Post a Comment