Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Submit form to new jquery tab

Posted on 2014-09-12
2
Medium Priority
?
305 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 83

Accepted Solution

by:
leakim971 earned 2000 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Six Sigma Control Plans

772 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