I have a function to delete a record from my BD but before deleting the record I show a confirmation message the problem is that the message is not shown, it goes directly to my function that does the elimination of the BD, what should I do so you can show the confirmation message and if you click on accept now if you go to the function that eliminates
$('#confirm-delete').on('show.bs.modal', function (e) {
EliminarFormula($(e.relatedTarget).data().id);
});
function Eliminar(idElimina) {
var url = "/Validador/Eliminar";
//var url = "#";
var data = new FormData();
data.append("idElimina", idElimina);
$.ajax({
type: "Post",
url: url,
datatype: "json",
contentType: false,
processData: false,
data: data,
success: function (data) {
if (data.Success === true) {
messageOK('Aviso', data.Mensaje);
}
else {
messageOK('Aviso', data.Mensaje);
}
},
error: function (xhr, status, errorthrow) {
}
});
}
<a data-id="123" data-toggle="modal" data-target="#confirm-delete"><span class="glyphicon glyphicon-trash"></span>X</a>