1<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
2
3$('.delete-confirm').on('click', function (event) {
4    event.preventDefault();
5    const url = $(this).attr('href');
6    swal({
7        title: 'Are you sure?',
8        text: 'This record and it`s details will be permanantly deleted!',
9        icon: 'warning',
10        buttons: ["Cancel", "Yes!"],
11    }).then(function(value) {
12        if (value) {
13            window.location.href = url;
14        }
15    });
16});1$(document).on('click', '.button', function (e) {
2    e.preventDefault();
3    var id = $(this).data('id');
4    swal({
5            title: "Are you sure!",
6            type: "error",
7            confirmButtonClass: "btn-danger",
8            confirmButtonText: "Yes!",
9            showCancelButton: true,
10        },
11        function() {
12            $.ajax({
13                type: "POST",
14                url: "{{url('/destroy')}}",
15                data: {id:id},
16                success: function (data) {
17                              //
18                    }         
19            });
20    });
21});