Reputation: 45
I have this thing. After I refresh the page the script is stop working. How do I need to do it to be working?
<a onclick="confirmation(event)" href="{{ url('trash/delete/'.$items->id) }}"> Delete</a>
This is the script
<script>
function confirmation(e) {
e.preventDefault();
var url = e.currentTarget.getAttribute('href')
Swal.fire({
icon: 'warning',
title: 'Are you sure?',
text: 'This action cannot be undone!',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, recall!'
}).then((result) => {
if (result.value) {
window.location.href=url;
}
})
}
</script>
i have try this : location.reload(); in multilocation, but not working
Upvotes: 1
Views: 78
Reputation: 63
your code works for me using this library
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
can you try with this and see if it will work?
Upvotes: 1