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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:27:43+00:00 2026-05-21T21:27:43+00:00

Right so I’m making a news system that uses jQuery and AJAX for the

  • 0

Right so I’m making a news system that uses jQuery and AJAX for the admining. Everything works great except that when I create a new post, and it is added to the table of news articles with AJAX I can’t then edit it without refreshing the page. My create form is using a .submit() event and so is my edit form. When a new article is posted, the edit form works but the submit button doesn’t work because it is created outside of the current .submit() scope.

Here’s some quick pseudo code.

My PHP script generates a table with a row of the news articles and then a hidden row beneath each news article that holds the form. jQuery activates the table row when the Edit link is pressed.

<tr>
  <td>news article</td>
</tr>
<tr style="display:none;">
  <td>hidden edit form</td>
</tr>

And then my javascript looks like:

$('#newsCreate').submit(function() {
    // do some ajax stuff to create news
    // when we add the news to the list we must add the table structure
    // so that means we have to add a form with an ID of "newsEdit"
    // as that is how the event is triggered
});

$('#newsEdit').submit(function() {
    // do some ajax stuff to edit news
    // this works perfectly by itself, but when the form is dynamically created
    // with the newsCreate block, this is outside the scope
});

So hopefully with my comments you can see what is going on. How can I fix this without copy/pasting 30 lines of code inside the newsCreate.submit()?

  • 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-21T21:27:44+00:00Added an answer on May 21, 2026 at 9:27 pm

    swap submit with

    `.live('submit',function(e){...});'
    

    here is the documentation for it
    http://api.jquery.com/live

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

Sidebar

Related Questions

Right now, I have a jQuery UI pop-up dialog that reads from an external
Right now I have a script that will get the last five files in
Right now I have a function, in a class that is used to listen
Right, hi guys, I recently followed a tutorial http://xnadevelopment.com/tutorials/thestateofthings/thestateofthings.shtml where I wanted to create
Right, so here the scenario: I've created a class called DiaryPage that inherites from
Right what I was trying to do is validate some input so that the
Right now I have an application that loads a bunch of thumbnail images into
Right now I've programmed a method for use in a swing program that is
Right now, I only understand that Global indexes on a partitioned table are for
Right, i'm new to PHP and mySQL, but i've got a few questions that

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.