Hello I have a code using sweetalert
swal("Good job!", "You clicked the button!", "success")
this code will pop-up a message and has a button okay, what I like to do is I want to refresh the page after I click the okay button.
Can I do that?
Use the callback function...
Swal.fire({
// Swal Setting's
}).then((result) => {
// Reload the Page
location.reload();
});
You can try this, it works for me.
swal({
title: "Good job",
text: "You clicked the button!",
type: "success"
},
function(){
location.reload();
}
);
The answer from Yoshioka did not work for me, I did this and it worked perfectly:
swal({title: "Good job", text: "You clicked the button!", type:
"success"}).then(function(){
location.reload();
}
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With