Please how do i show a confirm delete dialog button. so that if the user clicks on yes it will proceed with the deletion or else it won't delete the entry.
This is my code that works fine, but i do not know how to make it pop the "are you sure you want to delete dialog"
The HTML button
<a class='btn btn-danger delete_data' id="<?php echo $matched1; ?>">Blast</a>
<script type="text/javascript">
$(document).ready(function(){
$(".delete_data").click(function(){
var del_id = $(this).attr('id');
$.ajax({
type: 'POST',
url: 'delete.php',
data: 'delete_id='+del_id,
success: function(data){
if(!data){
window.location.replace("memberpage.php");
}
else{
alert('failed');
}
}
});
});
});
</script>
delete.php
$username = $_POST['delete_id'];
$stmt = $db->prepare("DELETE FROM users WHERE username='".$username."'");
$stmt->execute();
Thanks a you help me out