Reputation:
I'm going to try my hardest to try and explain what I'm trying to achieve essentially what I'm after is for the form to POST to the post_form_here.html
and then to redirect the main page to redirect_main_page.html
I need the form to post the values to the popout window and then to redirect the main page to the redirect page.
<form method="POST" onclick="window.open('POST_FORM_HERE.HTML', 'newwindow',
'width=500,height=500'); return true;" action="REDIRECT_MAIN_PAGE.HTML">
This is what I have so far however this posts the form to the redirect_main_page.html
and not the post_form_here.html
. Thank-you for any help and I hope I've explained what I'm trying to achieve well enough.
Upvotes: 1
Views: 1684
Reputation: 1668
Try this
HTML
<form id="form">
<input type="text" name="name" >
<input type="text" name="age" >
<input type="submit">
</form>
JS
var form = $("#form");
form.on("submit",function(){
window.open("POST_FORM_HERE.html?" + form.serialize(), "newwindow", 'width=500,height=500');
window.location.href = "/REDIRECT_MAIN_PAGE.html";
return false;
})
Upvotes: 2
Reputation: 2655
use target="_blank" in form
<form action="demo_form.asp" method="get" target="_blank">
</form>
If you want new window use like this
<form method="post"
target="new_popup"
action="https://www.google.co.in/"
onsubmit="window.open('about:blank','new_popup','width=500,height=300');">
<input type="text" />
<input type="submit" />
</form>
Upvotes: 3