Level 37
Well makes sense, because you are not making any delete request, you need to update your code
if (result.isConfirmed) {
// add logic here if the user confirmed the delete
// an example would be
$.ajax({
url: // your route here with the id of cat, you get value using tag id for example,
type: "GET",
success: function () {
swal("Done!", "It was succesfully deleted!", "success");
},
error: function (xhr, ajaxOptions, thrownError) {
swal("Error deleting!", "Please try again", "error");
}
});
Swal.fire(
'Deleted!',
'Your file has been deleted.',
'success'
)
}
Now once a user confirms the delete it will make a GET request to your defined route.
Just a side note, using a GET method for deleting things is a bad practice and can result in security issues (csrf), consider using DELETE method instead.
1 like