sweet alert in laravel 7 example
Example 1: sweet alert confirm box laravel
$(document).on('click', '.button', function (e) {
e.preventDefault();
var id = $(this).data('id');
swal({
title: "Are you sure!",
type: "error",
confirmButtonClass: "btn-danger",
confirmButtonText: "Yes!",
showCancelButton: true,
},
function() {
$.ajax({
type: "POST",
url: "{{url('/destroy')}}",
data: {id:id},
success: function (data) {
}
});
});
});
Example 2: sweetalert laravel
<script src="https://unpkg.com/[email protected]/dist/sweetalert2.all.js"></script>