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.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>
Perhaps try using $('.modal').remove();
Where '.modal' is the class of your modal
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.