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

  • Home
  • SEARCH
  • 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 7713379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:51:41+00:00 2026-06-01T01:51:41+00:00

I was working on a Login Form ( AJAX ) enabled. When a use

  • 0

I was working on a Login Form ( AJAX ) enabled. When a use clicks on link, that Login box, as a floating modal appears. The Content of that Login box is loaded from another page using jQuery’s $().load function. On click of the link the Login Box loads. But, when I implemented AJAX submitting on that form:

$(document).ready(function(){
    $("form#loginbox").submit(function(e){ e.preventDefault(); /*AJAX function here*/ });
});

But the form is submitted normally, without following what is given in the function, that is ( Prevent the Default – Submitting and use AJAX ). so does that mean the Loaded content is not considered inside DOM or the script cannot read it? I load the content only once:

$(document).ready(function(){
    if($("#loadedform").html() == "")
    { $(this).load('/load/login.html'); }
    $(".login-modal').slideDown('slow');
});

The structure:

<div class="login-modal"><div id="loadedform"></div></div>

the content to be loaded:

<form id="loginbox" method="post" action="xyz.html">
<!-- INPUT Boxes and Submit Button -->
</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-06-01T01:51:42+00:00Added an answer on June 1, 2026 at 1:51 am

    Change

    $("form#loginbox").submit(function(e){ 
        e.preventDefault(); 
        /*AJAX function here*/ 
    });
    

    to

    $('#loadedform').on("submit", "form#loginbox", function(e){ 
        e.preventDefault(); 
        /*AJAX function here*/ 
    });
    

    or if you’re using a version before 1.7:

    $('#loadedform').delegate("#loginbox", "submit", function(e){ 
        e.preventDefault(); 
        /*AJAX function here*/ 
    });
    

    This is because the event is registered when the page is loaded, so when your form is loaded it does not have the event attached. This change will register the event at a higher level in the dom so any new content will also work.

    It also looks like you should change the code that loads the form to:

    if($("#loadedform").html() == "") { 
        $("#loadedform").load('/load/login.html'); 
    }
    $(".login-modal').slideDown('slow');
    

    Otherwise you won’t be loading it into the right place.

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

Sidebar

Related Questions

Here is my scenario. I have a working login form that functions correctly. I
I'm working on an AJAX login system. Right now, when the user clicks on
I'm working on a simple login form. When the user clicks on the Login
I'm working on a website with a login form. To log in, a postback
I'm using PHP 4.3.9, Apache/2.0.52 I'm trying to get a login system working that
I am working on a single sign-on login page using Shibboleth that will be
I am working on a site that uses Facebook Connect for user login/creation. I
I am working on a project that has a requirement such that login details
I have a working PHP registration form that goes through $_POST[] requests to check
I have the WordPress Login form working in the front-end of my website, to

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.