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 6337797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:19:12+00:00 2026-05-24T19:19:12+00:00

I have a form in a jQuery tab div that is loaded with AJAX:

  • 0

I have a form in a jQuery tab div that is loaded with AJAX:

<div id="tabs-2">
    <form id="frmLogin" name="frmLogin" class="cmxform" method="post" action="actions/login.php">
        <p>
            <label>Username</label>
            <input type="text" id="username" name="username" maxlength="30" />
        </p>
        <div class="clear"></div>
        <p>
            <label>Password</label>
            <input type="password" id="password" name="password" maxlength="40" />
        </p>
        <p>
        <input class="submit" type="submit" id="submit" value="Login" />
        </p>
        <div class="clear"></div>
    </form>

</div>

The form submits to the listed PHP file. This .js file using the Form and Validation jQuery plugins submits the form via AJAX. The PHP file echoes back JSON data:

$(document).ready(function() { 
$("#frmLogin").validate({
                    rules: {
                            username: {
                                required: true,
                                minlength: 6
                            },
                            password: {
                            required: true,
                            minlength: 6
                            },
                            },
                            submitHandler: function(form) {
                                $("#frmLogin").ajaxSubmit({
                                                        dataType: 'json',
                                                        success:    processLogin,
                                                        })
                            }
});
function processLogin(data) {
    if (data.un) {
        $("div#tabs-2").slideUp(function() {
            $("li#login").html('<a href="ajax/loggedin.html">Welcome, '+data.fn+'</a>');
        });
    } else {
        alert("uh-oh"); 
    }
}
});

This all works fine. I’ve got the link which previously read “Login” to read back a Welcome message. Now I want to replace that tab’s contents (login form) with a ul of user options.

The problem: the link with the Welcome message no longer functions as a tab. When clicked, it directs the browser to the “ajax/loggedin.html.”

I’ve tried restating the tabs function in the “loggedin.html” file and calling it in the processLogin function in “login.js”. My next fix attempt will be to change the html content of the tabs-2 div in the processLogin function, but this seems like it will generate a lot of clunky code.

Any suggestions for preventing the disabling of the tab behavior?

  • 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-24T19:19:13+00:00Added an answer on May 24, 2026 at 7:19 pm

    This the classic when-code-is-run problem. You are setting the tab behavior to check for tabs and set them up. Then you load new code, but you haven’t initialized the tab for these.

    The solutions are to use delegate (or live) instead of direct click events or to initialize the tabs in the ajax callback. The latter is the best solution for this problem.

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

Sidebar

Related Questions

I have a form that uses jQuery to submit an ajax post and it
I have the following form <form id=myform method=post action=#> <div class=fields> <fieldset class=ui-widget ui-widget-content
I have a form that I pre-populate with test data though jQuery. $('INPUT[name=subscription.FirstName]').val('Jef'); but
I have a method set up that uses jquery form for a file upload
I have the following jQuery code: $.ajax({ type: POST, url: /search, data: $(form).serialize(), success:
i have a simple jquery tab and a form. When i post the form
I have written a form using the jQuery .post() function to post the data
I have used jquery tabs for loading data with ajax, but I need to
I have a form with multiple steps like jquery tabs. My intention is to
I have a web page consisting a JQuery UI Tabs widget. Tab widget loads

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.