php - Lists of buttons firing same ajax request -
i'm developing php application manage shooting tournaments. problem is, need load table, in each table row have button id. button fire ajax request returns me table other information.
how can utilize plenty of buttons same id fires same ajax request.
some code fragments below
php code used build each row of table
<tr> <td align='center'>{$shooter_name}</td> <td align='center'>{$entry_id}</td> <td align='center'> <form> <input type='hidden' id='id_tournament_name' value='{$tournament_name}'> <input type='hidden' id='id_shooter_name' value='{$shooter_name}'> <input type='button' class='btn btn-primary btn-table' id='show_entries_by_shooter_list_button' value='ver fichas'> </form> </td>
the 3rd input creates buttons, same id.
ajax request
// ajax request sends do_a_show_entries_by_shooter request (from tournament entries list) server. $('#show_entries_by_shooter_list_button').off("click"); $('#show_entries_by_shooter_list_button').click(function () { $.ajax({ type: "post", url: "do_a_show_entries_by_shooter.php", data: { tournament_name: $('#id_tournament_name').val(), shooter_name: $('#id_shooter_name').val(), }, datatype: "html", success: function(response){ $("#general_use_div").html(response).fadein("slow"); } }); });
php jquery ajax
No comments:
Post a Comment