I have a question with the confirmation before deleting a record from my Database, for this I am using PHP and the AlertifyJS library, in my HTML structure I have a link through which I send by GET method the id of the person to delete, in this same link I have a class called delete which I use in JQuery to trigger the function that contains the alertify.confirm , it is worth mentioning that if you delete the person but the problem is that he sends me the confirmation but he does not let me decide if I want to eliminate the user or not.
<a href="becarios.php?becarioid=<?php echo $registro['id_becario'];?>" class="enlace-table elimina" data-toggle="tooltip" data-placement="bottom" title="Eliminar Becario" alt="Eliminar Becario">
<i class="fas fa-times-circle"></i>
</a>
JQuery code
$(document).ready(function()
{
$('.elimina').on('click', function() {
validaBaja();
});
});
function validaBaja() {
alertify.confirm("Deseas eliminar al usuario",
function(){
alertify.success('Eliminado');
},
function(){
alertify.error('Cancelado');
}
);
}
PHP Code
$delBecario = verificaId($_GET['becarioid']);
if (!empty($delBecario))
{
$sql_del_becario = "DELETE FROM becarios WHERE id_becario='$delBecario'";
$elimina = eliminaRegistro($sql_del_becario, $conecta);
if ($elimina !== false)
{
header('Location:becarios.php');
}
}
Greetings.