I want to take my existing append data code and change it so that instead of appending to all rows or the end of a table, the data is appended to each row with unique data. In each row I have a button that takes passed variables to ensure each button is specific to that row of data.

I want the appending to occur on the Success function. This is how I would like to append the data but am not sure what to do in order to make that happen. Some help would be appreciated.

**AJAX**

**PHP that creates the rows with the html **

Jquery that creates the initial button and passes the variables to the AJAX. It is a shortcode that launches on page opening.

Couple of points:
Your <button> elements in the shortcode all have the same id. You also set an href on them which only goes on an <a> tag.
—-
I’m seeing a lot of mixing of PHP and your page code, this is going to be a maintenance/testing nightmare. You basically never want your PHP exporting chunks of Javascript.
Instead of something like this
I would go with a separate scripts.js file where your JavaScript lives.
I would even update your options_function endpoint to give you back JSON and build that row in the same way I did the generate_row() funciton.
—-
You are sending a POST request, but you aren’t really posting anything- you probably want to be doing a get request using URL params instead of a POST with data. It’s not a huge issue, but it’s confusing for anyone reading your code in the future.
Generally, GET is for a request with no side effects, PUT changes the state of an existing entity that can be repeated without causing an issue (PUT light switch -> on) doesn’t create a switch, and if you turn on a switch that is already on, nothing happens. POST creates a new thing (like posting a user creates a new user), and DELETE removes an existing resource.

source