Solved

Submit form to new jquery tab

Posted on 2014-09-12
2
290 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
Comment Utility
$("#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
Comment Utility
great thanks !
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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.
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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…

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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now