Then, if they want to add a post, I upload the data to a MySQL database with JQuery AJAX in the background, and on success, I get the ID of that post, and insert it with .after in my form. The problem is when I do this, select the post and delete it, it doesn't see that new post as part of the form and won't delete it unless I refresh the page.
Any idea how to fix this? Here is the code performed when creating a post and when deleting it.
I'm working on a mini CMS for a racing team and here is my issue.
When they log on, PHP will generate a <form> with a <fieldset> chunk for each post they have done.
Then, if they want to add a post, I upload the data to a MySQL database with JQuery AJAX in the background, and on success, I get the ID of that post, and insert it with .after in my form. The problem is when I do this, select the post and delete it, it doesn't see that new post as part of the form and won't delete it unless I refresh the page.
Any idea how to fix this? Here is the code performed when creating a post and when deleting it.
submit_post function:
delete_post function: