Can anyone tell me why the following code fails to submit the form into a popup?
A click in link should submit a form into a popup
$(".myClass").click(function ()
{
var myVar = $(this).attr("rel");
//$(this).closest("form").submit();
$("#form_id"+myVar).submit(function()
{
window.open('', 'formpopup', 'width=700,height=550,resizeable,scrollbars');
this.target = 'formpopup';
});
return false;
})
if i remove the popup option and have just the $(this).closest(“form”).submit(); it works.
But as it is it fails.
Any thoughts/suggestions?
There is no js error in firebug.
NOTE: at the moment we do not want to use modal windows – so please no modal suggestions.
You never actually submit the form. You only bind a
submitevent handler to it. You can usesubmitortriggerto actually trigger thesubmitevent:Your commented out call to
submitwill occur before the event handler has been bound to the form, so it would never be executed.