Posting a form to popup form using jquery and fancybox

一个人想着一个人 提交于 2019-12-08 07:53:24

问题


I am trying to post from a form to another form in a fancybox ( http://fancybox.net/ ) window.

For example I have a list of cities with tickboxes on a form.

When the user clicks submit on the first form, I am hoping for the fancybox window to appear with another form in. There will be a textbox on the new form that has the city ids selected on the previous form hidden as form elements.

The problem I am having is popping up the fancybox window when the form is submitted.

I either end up redirecting the user to the second form completely or the popup window isn't a fancybox window.

The closest I have come so far was using some code I found on another site. The problem with this is the popup is a normal browser window.

<form id="myform" action="..." method="post">
<!-- form fields etc here -->
</form>

$(document).ready(function() {
    $('#myform').submit(function() {
        window.open('', 'formpopup', 'width=400,height=400,resizeable,scrollbars');
        this.target = 'formpopup';
    });
});

Thanks in advance.


回答1:


Resolved using the jQuery Form Plugin (http://malsup.com/jquery/form/).

Open Fancybox (or equiv) from Form input type="submit"

Thanks



来源:https://stackoverflow.com/questions/2916247/posting-a-form-to-popup-form-using-jquery-and-fancybox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!