Delete button is not working on other pages except first
Delete button is not working on other pages except first
i have action column in the table in which one delete button and i am using jquery post function to delete any row. But Delete button is only working on the first page. it is not working on other pages.
Here is my delete button.
<button class="btn btn-danger delete_seminar" value="<?php echo $row['id'] ?>"> <span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
and my jquery function.
$(function() {
$(".delete_seminar").on('click', function(event) {
if (confirm("Are you sure?")) {
var data = $(this).val();
$.post('requests/seminars.php', {delete_sem: data}, function(data) {
if (data == "delete") {
location.reload();
}else{
alert(data);
};
});
}
});
})
i dont know how to resolve this problem. please help me to come out from this problem.
Answers
use $("#yourtableId").on('click','.delete_seminar', function(event)
read this link
http://www.gyrocode.com/articles/jquery-datatables-why-click-event-handler-does-not-work/