Friday, 15 August 2014

javascript - I need to submit the form and redirect the parent page on form submission in a fancy box -



javascript - I need to submit the form and redirect the parent page on form submission in a fancy box -

this form code given in fancybox popup iframe page.

i need close popup , redirect parent page

http://luxuryresortstayvouchers.com/newdesign/?p=list.php

when submit button pressed.

following function closing fancybox popup parent page not redirected desired location.

function closemeup() { parent.$.fancybox.close(); } <form action=""http://luxuryresortstayvouchers.com/newdesign/?p=list.php method="post" target="_parent" class="form_class" enctype="multipart/form-data" > <input class="vouch_num" type="text" placeholder="checkin date" maxlength="25" size="50" id="datepicker" /> <input class="vouch_num" type="text" placeholder="checkout date" maxlength="25" size="50" id="datepicker2" /> <br /> <input type="button" id="ok" class="submit_but" value="submit" onclick="closemeup();" /> <input type="button" id="cancel" class="cancel_but" value="cancel" /> </form>

any help highly appreciated.

thanks.

you utilize parent.window.location.href property within onsubmit attribute of (iframed) form :

<form id="login_form" onsubmit="javascript:parent.window.location.href='http://luxuryresortstayvouchers.com/newdesign/?p=list.php';" > ... </form>

notice don't have forcefulness closing fancybox since page redirection job.

also notice if close fancybox manually (without submitting form), parent page won't redirected.

see jsfiddle

javascript jquery forms fancybox

No comments:

Post a Comment