laravel sweet alerts code example

Example 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;
        }
    });
});

Example 2: sweetalert laravel

<script src="https://unpkg.com/[email protected]/dist/sweetalert2.all.js"></script>

Tags:

Php Example