php - Jquery handle the buttons in a table -
I did not find a good answer to this question that makes sense.
I have a table showing and there is a button to join the game in the row at the end of each row in the table
button just < Pre> Each Button ID is the id of the game's user game line. So when a user clicks the button on that line then I need jquery to run a post to save the game to user I have a backend PHP code that actually saves the user But I do not know how to send a Jquery post with a button ID Add JQuery as a selector I use them all To provide a class-League to Amil. Then listen to the click events on those buttons you can catch the game ID and use it to submit a form or make an AJAX call so that the user can be saved in that game. HTML js JSFiddle example < / Html> & lt; Td> & Lt; Button class = "btn-u btn-u-xs rounded-2x btn-u-default" id = "& lt ;? php echo $ game ['id'];? & Gt;" Type = "button" & gt; Join The League; / Button & gt; & Lt; / Td>
& lt; Td> & Lt; Button class = "btn-u btn-u-xs globular-2x btn-u-default joint league" id = "
$ ('.stopPropagation (); var gameId = $ (This) .attr ('id'); ... do stuff, submit form or call AJAX});
Comments
Post a Comment