Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1010217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T09:02:53+00:00 2026-05-16T09:02:53+00:00

I am using the jQuery UI Tabs to display a number of forms (each

  • 0

I am using the jQuery UI Tabs to display a number of forms (each tab can contain more than one form). When I switch between tabs, I am attempting to do POST of the tab’s forms using AJAX calls. Here is the jQuery for what I am doing.

select: function (event, ui) {
        var tab_index = $('#tabs').tabs('option', 'selected');
        var panel_id = $("ul li a:eq(" + tab_index + ")", this).attr("href");
        var panel = $(panel_id); // the content of the tab

        // For each form in the panel, submit it via AJAX and update its HTML accordingly.
        $(panel).find("form").each(function () {
            var that = this;
            $.post($(this).attr("action"), $(this).serialize(), function (data, success) {
                if (success) {
                    $(that).html(data);
                }
            });
        });
    },

This works in IE and partially works in Firefox. On some of the tabs within Firefox, when I switch between tabs after a few times, two quick posts happen in succession (I can see it happen in the Console). This results in the incorrect data being posted back to the HTML (I lose error messages and the original data from the server). I can reproduce this problem every single time. Anybody have any suggestions as to what is happening here?

Update: They problem happens consistently on the same tabs. There is nothing obviously different (or no similarities exist) between the tabs that work, and those that fail. With respect to the data being POSTed when two happen quickly in a row, the first POST contains no data (AKA, I don’t think serialization is happening properly) and the second POST is the correct form, but it has none of the changes that I made to the form (because the first POST reset the form).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T09:02:54+00:00Added an answer on May 16, 2026 at 9:02 am

    It turned out the problem was very simple (the “biggest” bugs always are).

    Basically, when I was submitting the various forms (via the individual tab forms), I had to inject the posted form back into the tab so that the user could see any updates or errors that occurred to the data after processing the POST. So, I was doing that like this (originally):

    // Post a form when it has been submitted.
    function postForm(form) {
        $.post($(form).attr("action"), $(form).serialize(), function (data, success) {
            if (success) {
                $(form).html(data);
            }
        });
    }
    

    What I didn’t know (basically due to a “reading fail”) is that the .html(data) method INJECTS rather than REPLACES. As a result, I was “nesting” forms which was causing all sorts of errors in other portions of my website.

    As a result, when I changed the code so it injects into the parent (like the following code), it worked perfectly, and also fixed a few other problems I was having:

    // Post a form when it has been submitted.
    function postForm(form) {
        $.post($(form).attr("action"), $(form).serialize(), function (data, success) {
            if (success) {
                // Inject the resulting form back into the parent of the page.
                var parent = $(form).parent();
                parent.removeData($(form));
                parent.html(data);
            }
        });
    }
    

    Reading the documentation…always a good thing…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using jQuery tabs, and I added some spans to the tab headers so
I m using jquery ui tabs and i m using them with the function
Is it possible, using jQuery Tabs (Sortable) to pre-sort them by the current day?
I am using jquery-ui tabs and ajax to load the content of the tabs.
i am using jquery UI tabs. works great. i have right now 5 tabs
i want to show my input data from DB...i'm interest for using jquery dataTable...
I have a jQuery tab section - and I want to animate the panels
I have a number of pages that include the same partial view which contains
I have a problem. I would like to use the animate() function to slide
I seem to have a strange problem. I am working on a simple dashboard

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.