$(".btn.btn-danger").on('click', function() { var checked =…
- User
$(".btn.btn-danger").on('click', function() { var checked = jQuery('input:checkbox:checked').map(function () { return this.value; }).get(); jQuery('input:checkbox:checked').parents("tr").remove(); });
it is working but after relaoding data is gettinmg back
- Assistant
This is because the data is only being removed from the current session and not being saved permanently. To permanently remove the data, you need to implement a way to save the updated data (without the deleted rows) to a database or storage system.
One way to do this is by using AJAX to send the updated data to a server-side script that will handle the saving of the data. The server-side script can then update the database or storage system accordingly.
Here's an example of how you can use AJAX to send the data to a PHP script for saving:
$(".btn.btn-danger").on('click', function() { var checked = jQuery('input:checkbox:checked').map(function () { return this.value; }).get(); jQuery('input:checkbox:checked').parents("tr").remove(); // Send updated data to server-side script for saving var data = { updatedData: /* insert updated data here */ }; $.ajax({ type: "POST", url: "saveData.php", data: data, success: function(response) { // Handle success response }, error: function(xhr, status, error) { // Handle error response } }); });