Solved

Submit form to new jquery tab

Posted on 2014-09-12
2
296 Views
Last Modified: 2014-09-13
Hello,
We need to open a new jquery tab programmatically when submitting a form :
Let's say we have tab-1 with a form inside. When we submit the form, a new tab opens, tab-2, with the result of the form. Both tab-1 and tab-2 are loaded in ajax, so we kind of need to "convert" :
append(data).tabs('add', curLink, curName)
to a submit
Is it possible ?
0
Comment
Question by:javilmer
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 40320349
$("#tab1 form").submit(function(evt) { // when submitting form in tab1
    evt.preventDefault(); // needed to prevent submit of the form and reload/change page
    $.post("/path/to/server/page.ext", $(this).serializeArray(), function(resultOfTheForm) { // assuming form use POST else replace by $.get
           $("#tab-2 div.content").html( resultOfTheForm ); // fill tab2 with result
           $( "#tabs" ).tabs( "option", "active", 2 ); // set tab 2 active
    });
});

Open in new window

0
 

Author Closing Comment

by:javilmer
ID: 40320717
great thanks !
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question