.click() and getting row ID from tables
Hi !
Let's say I have a dynamic table output from a database onto a PHP page that looks something like this - I have removed some columns to keep things clear :
- <table class="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr>
<td>Tony</td>
<td>
<button id="banUser" type="button" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-ban-circle" aria-hidden="true"></span></button>
</td>
</tr>
</table>
When the button is clicked (i.e JavaScript style onClick or jQuery equivalent), I need a way to pass the user ID to the javascript (the javascript will either POST or make an AJAX call to the database).
What is the best way to pass the ID ?