Solved

Submit form to new jquery tab

Posted on 2014-09-12
2
303 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Six Sigma Control Plans
Introduction to Processes

628 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