I have a page where users filter results from the Ultimate WP Query Search Filter plugin. The results are shown in a DIV via an AJAX call. This is working 100%. However I have another AJAX function attached to each result in the query allowing users to create a new post from search results.
(See this post for how I got that to work Create new Wordpress post [wp_insert_post] based on results of a WP_Query)
The problem I am having now is that when I view the wp_query results - I have a button on each record to "Add" to. When I trigger the button on the first item it works 100%. However when I click on any of the subsequent items - it still creates the post, but ignores all the values attached to it.
I am guessing I need to reset the AJAX function after each call, but unsure how to do that?
Here is the code for adding the posts: https://gist.github.com/stankobrin/4d15c29024e306b2ea43 Here is the JS / AJAX code: https://gist.github.com/stankobrin/61843fefef464e8778a3
Any help on this would be appreciated - I have spent countless hours trying everything!