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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:26:51+00:00 2026-05-18T04:26:51+00:00

I have a global form which I want to use the same form every

  • 0

I have a global form which I want to use the same form every time on submit, and this form is auto generated depends on how many threads are produced from the database. so I might a two or four form of the same kind when the page is loaded. Also, this type of form will be loaded onto the page on certain request through ajax. and the most important is – all these form will use the same submit function.

for instance,

the html

<div class="form"></div>
<a href="form.php" class="load">load</a>

<div>
<form action="#" method="post" enctype="multipart/form-data" class="form-global">
    <textarea name="str_content" title="Write a comment..."></textarea>
    <input type="submit" name="submit" value="SUBMIT" class="button-public left"/>
</form>
</div>

<div>
<form action="#" method="post" enctype="multipart/form-data" class="form-global">
    <textarea name="str_content" title="Write a comment..."></textarea>
    <input type="submit" name="submit" value="SUBMIT" class="button-public left"/>
</form>
</div>

below is the working code in jquery,

$(document).ready(function() {

    sumbitform();

    $(".load").click(function () {
        var path = $(this).attr('href');

        $('.form').load( path, {}, function(){

            sumbitform();

            //$(this).bind("submit", sumbitform);
        });

        return false;
    });


});

this.sumbitform = function(){

    $("form.form-global").submit(function(){
        alert('1');
        return false;
    });
}

all the forms work as normal when the page is loaded, the submit only happens once on each form. but the problem occurs whenever a new form of the same kind is loaded through ajax, the other existing forms will trigger twice.

you can see problem on this link,
http://nano-visions.net/dump/jquery.ajaxsubmit/

how can I resolve this problem? can I attach the submit function to the ajax loaded form only like this line below?

$(this).bind("submit", sumbitform); // doesn't work obviously

or any other better ideas?

thanks.

  • 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-18T04:26:52+00:00Added an answer on May 18, 2026 at 4:26 am

    You need to use $(this).live("submit", sumbitform); instead. This will bind the same event to elements which appear later on, not just the ones which are around right now.

    For more info check out live in the jQuery docs.

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

Sidebar

Related Questions

I have a class Application that my global.asax inherits from. The class has this
I have a python module that makes use of a huge dictionary global variable,
I have two assemblies with the same name in the Global Assembly cache, but
I have a Delphi DLL that houses a form which uses a variety of
I want to remove a particular tabpage from the tabcontrol. For which i have
i have a form which allows the user to upload some files to a
I have some global variables in a Python script. Some functions in that script
VB 6.0 does not have any global handler.To catch runtime errors,we need to add
Hey right now I'm using jQuery and I have some global variables to hold
I have defined the global nls_date_format on Oracle 10.2 XE as follows: alter system

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.