I have several pages on my website that refresh the pages after a function using javascript or sometimes turbolinks and even action cable.
I want to use SweetAlert to display information but its not very helpful because it displays right before a refresh so it is only visible for a quick moment.
Based on previous stack overflow questions I have constructed this:
Swal.fire({
title: 'Sweet!',
text: `You got the ${data.badge.description} badge!`,
imageUrl: data.badge_image_url,
imageWidth: 200,
imageHeight: 200,
imageAlt: 'Custom image'
},
function(isConfirm) {
if (isConfirm) {
window.location.reload();
}
});
However, it does not seem to fix the issue.
You Can try something like this: