I use this code to trigger the row delete:
<a href="javascript:void(0);" onclick='$.get("web_page.php",{ cmd: "delete_stmt", id_f: "<?php echo $rrows['id_f']; ?>", id: "<?php echo $row['id']; ?>" } ,self.location="web_page.php");'>delete</a>
and this is the code:
if($get['cmd'] == 'delete_stmt') {
$stmt = $conn_bd->prepare("DELETE FROM table WHERE id_f=:id_f and id=:id");
$stmt->execute(array('id_f' => $get[id_f], 'id' => $get[id]));
$stmt->execute();
}
the record is always deleted from the database table, but sometimes the record is displayed on the web page.
this happens in IE, Firefox, Chrome …
do you have an idea what could be causing this?
thk
Change your link to this:
… and add this function:
The link will call the deleteItem function which does the ajax call, it then waits for the success event before doing the page redirect.