<tr>
<td><?php echo $row['id']; ?></td>
<td><?php echo $row['title']; ?></td>
<td><?php echo $row['description']; ?></td>
<td><div class="delete_class" id="<?php echo $row['id']; ?>">Delete</div></td>
</tr>
Schrijf dit nu in de sectie
$(document).ready(function(){
$(".delete_class").click(function(){
var del_id = $(this).attr('id');
$.ajax({
type:'POST',
url:'delete_page.php',
data:'delete_id='+del_id,
success:function(data) {
if(data) { // DO SOMETHING
} else { // DO SOMETHING }
}
});
});
});
Doe dit nu op de pagina 'delete_page.php'
$id = $_POST['delete_id'];
$query = "delete from TABLE NAME where ID = $id";
Rust, ik hoop dat je het weet. Ik hoop dat dit helpt