I have an application that saves in a database and has a button to delete, I already performed the delete function and ask for confirmation, but when the cancel button is given it also deletes the record. The function that I have is this:
<script>
function confirmDel() {
var agree = confirm("¿Realmente desea eliminarlo? ");
if (agree) return true;
return false;
}
</script>
And I call it on the button like this:
<a onclick="confirmDel();" href="@Url.Action("Eliminar", "Agenda", new { id = contacto.Id })" class="btn btn-danger">Eliminar</a>
I hope to have your help.