I have a link that when clicking opens a modal asking if the user wants to delete the record. In the link I have a href that calls a route to do the deletion. How could you do to call this route only if you click the delete button?
Link:
<a id="danger-alert" href="{{ route('admin.categories.destroy', $category) }}"><i class="zmdi zmdi-delete zmdi-hc-lg"></i></a>
Function:
$('#danger-alert').click(function () {
swal({
title: "Deseja excluir o registro?",
//text: "You will not be able to recover this imaginary file!",
type: "error",
showCancelButton: true,
confirmButtonClass: 'btn-danger waves-effect waves-light',
confirmButtonText: 'Excluir'
});
});