<button type="btn" class="btn_cancel deleteOnElement" type="button" data-route="{{ route('cancel-order', $order_id) }}">Cancel</button>
<!-- sweet alert -->
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<script type="text/javascript">
//end application user type
$(document).on('click','.deleteOnElement', function(event)
{
var route = $(this).data('route');
//alert(route);
swal({
title: "Confirm Trash",
text: "Are you sure you want to cancel this request? ",
icon: "warning",
buttons: true,
dangerMode: true,
})
.then((willDelete) => {
if (willDelete) {
window.location.replace(route);
} else {
swal("Your data is safe!");
}
});
});
</script>
Comments
Post a Comment