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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:53:25+00:00 2026-06-18T04:53:25+00:00

I have a list of items which is dynamically updated via an ajax call

  • 0

I have a list of items which is dynamically updated via an ajax call whenever a new item is added. There’s a comment form included in each of these list items that has a comment field and a hidden field which indicates which item has been commented on.

I’m using the jquery form plugin to submit these forms using ajax. The problem I keep running into is that the forms are not recognized by the plugin so they run normally (posting and redirecting to ajax/comment.php). After doing some digging I think this is because the forms are being loaded dynamically and the script can’t ‘see’ them. I’ve read about eval() being a possible solution to get the script to run correctly. Right now the code executes correctly if I don’t use ajax to populate the page.

 <script>
$(document).ready(function() { 
var options = {  
    url: 'ajax/comment.php',
}; 
$('.commentsubmit').submit(function() { 
    $(this).ajaxSubmit(options); 

    return false; 
}); 
}); 

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

    If the forms are loaded dynamically, change .submit to this:

    $(document).on('submit', '.commentsubmit', function () {
    

    This will delegate the submit event to any .commentsubmit forms that may not be added to the DOM at the time you call .on.

    On an unrelated note, use e.preventDefault(), not return false: http://fuelyourcoding.com/jquery-events-stop-misusing-return-false/

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

Sidebar

Related Questions

I have a list which is dynamically built, but there are empty list items
I have list of items in my activity which I load dynamically, item after
I have a list of tab items that have views dynamically added to them.
I have a view that has a list of items (which can be added
I have a list view in which I add items dynamically. I want that
I have a list of items ('sections') which has a getter and a setter.
I have a List<MyClass> with 2 items which have a SequenceNumber property. If I
I have a list of items of type ViewLookupItem which has these properties: For
I have a list of items, which has two values, a name and an
I have a page with a list of elements display (items) - which are

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.