This is the simple script that I use every time I build one page sites… I use this code to update, delete, modify, add data to Mysql or other DB’s…
This code also get the class or id of the clicked link and can display a result there or in another div… this script can also be modified to play other important parts in the web app…
Hope it helps.
1 2 3 4 5 6 7 8 9 10 11 12 |
$('.get-delete').click(function() { var get_id = $(this).attr('id'); $("#" + get_id ).toggle(400); $.ajax({ type: 'POST', url: 'delete.php', data: { idx: get_id}, success: function(response) { $('#result').html(response); } }); }); |