如何在重定向到页面选择之前在此处正确实现甜蜜警报以进行确认

@if(count($notes) > 0)
    @foreach($notes as $lk)
   <a href="{{'view',$lk->id}}"  data-id="{{ $lk->id }}" data-slug="{{ $lk->slug }}" id="viewNote">                                                                         </a>
    @endforeach
  @endif

的MyScript

function SwalView(id) {

        swal({
            title: 'Are you sure?',
            text: 'You will not be able to recover this event!',
            type: 'warning',
            showCancelButton: true,
            confirmButtonColor: '#3085d6',
            cancelButtonColor: '#d33',
            confirmButtonText: 'Yes, delete it!',
            closeOnConfirm: false
        }).then(function() {

                swal({
                    title: "Deleted",
                    text: "View note",
                    type: "success"
                }).then(function() {
                    location.href = '/notes';
                });
            });
        });
    }

我将被重定向到页面上进行选择