1
I have a link that opens a modal asking if the user wants to delete the record. On the link I have a href that calls a route to delete. How could I call this route only if I 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'
});
});
You say block access to the URL if the user tries to access it otherwise?
– Jéf Bueno
I need to include a button that the user confirms that they want to delete. I am using a Dashboard that has this function ready. When clicking on the link it calls the function through the ID that displays a modal with the cancel or delete button. If he clicks delete continue the execution by calling the route that is in href.
– Marcelo