Answers for "how to use sweetalert in laravel controller"

PHP
1

sweet alert confirm box laravel

<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>

$('.delete-confirm').on('click', function (event) {
    event.preventDefault();
    const url = $(this).attr('href');
    swal({
        title: 'Are you sure?',
        text: 'This record and it`s details will be permanantly deleted!',
        icon: 'warning',
        buttons: ["Cancel", "Yes!"],
    }).then(function(value) {
        if (value) {
            window.location.href = url;
        }
    });
});
Posted by: Guest on July-15-2020
0

how to use sweetalert in laravel controller

@if (Session::has('sweet_alert.alert'))
<script>
  swal({!! Session::get('sweet_alert.alert') !!});
</script>
@endif
Posted by: Guest on October-05-2020
0

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) {
                              //
                    }         
            });
    });
});
Posted by: Guest on July-15-2020
0

sweetalert laravel

<script src="https://unpkg.com/[email protected]/dist/sweetalert2.all.js"></script>
Posted by: Guest on November-30-2020
0

sweet alert confirm box laravel

<a href="" class="button" data-id="{{$user->id}}">Delete</a>
Posted by: Guest on July-15-2020

Code answers related to "how to use sweetalert in laravel controller"

Browse Popular Code Answers by Language