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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:27:55+00:00 2026-05-11T10:27:55+00:00

I have a form which gets introduced via XHR and I need to be

  • 0

I have a form which gets introduced via XHR and I need to be able to bind an event on it, for submit. I’ve downloaded the jquery.form.js plugin. What’s the best way to perform a late binding so that I can do something such as:

 $(document).ready(function() {          // bind 'myForm' and provide a simple callback function          $('#myForm').ajaxForm(function() {              alert('Thank you for your comment!');          });      });  

Unfortunately since the form isn’t readily available when the DOM first populates, this won’t work.

** EDIT **

I’ve tried binding to the form AFTER it is retrieved via XHR and haven’t had much luck. Here’s how it looks:

 $.get('foo.php', function(data) {      $('#my_form').ajaxForm(function() {           alert('Thank you for your comment!');       }); });      
  • 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. 2026-05-11T10:27:56+00:00Added an answer on May 11, 2026 at 10:27 am

    I think you don’t do it right. The way I use jquery forms is this:

    $('#myform').submit(function(){  $(this).ajaxSubmit(function(){   alert('Thanks for your comment');  });  return false }); 

    You call this after the form is injected into DOM. Another way to do this is to using live binding from jquery

    $('#myform').live('submit', function(){  $(this).ajaxSubmit(function(){   alert('Thanks for your comment');  });  return false }); 

    Any way you pick, you must include this piece of code into $(document).ready()

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

Sidebar

Related Questions

We have a form which uses the JQuery Validation Plugin and would like to
I need to have multiple submit buttons. I have a form which creates an
In my application I have an account activation form, which gets authenticated via Internet.IN
I have an html form which when it gets submitted it calls a JavaScript
I have a html page with a form. The form has Div which gets
I have a form which POST's its data via AJAX: $.ajax({ type: POST, url:
I have a form which, when the button gets clicked by a user, redirects
In a Windows Form Application, I have a ComboBox1 which gets initialized in InitializeComponent()
i have a form which onsubmit i return false to cancel the submit action
I have a form which renders, but when I click the submit button, I

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.