ASP.NET MVC How do i close fancybox on form post

Posted by Azhar Rana on Stack Overflow See other posts from Stack Overflow or by Azhar Rana
Published on 2012-03-29T20:01:56Z Indexed on 2012/03/29 23:29 UTC
Read the original article Hit count: 474

Filed under:
|
|

I have a fancybox popup with a form inside it. When the form is posted it all works fine BUT after it is posted it redirects to the view and shows it on a full page.

What i want is for the popup for to be posted and the fancy box to be closed.

Here is my code

Main Page This opens the popup fine

<%: Html.ActionLink("Add Person Box", "AddTest", Nothing, New With {.class = "fbox"})%>

    <script type="text/javascript">
        $(document).ready(function () {

            $(".fbox").fancybox();

        });
    </script>

Popup page

<% Using Html.BeginForm() %>
    <input type="submit" value="Save Person" />

<% End Using %>

Again this submits fine but redirects to itself in full screen mode. i just want the form to be posted and the fancy box to be closed.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about ASP.NET