Reputation: 1500
$("#customerAdded").modal("show").on("shown.bs.modal", function () {
window.setTimeout(function () {
$("#customerAdded").modal("hide");
}, 5000);
location.reload();
});
Ok, it works. But with location.reload(), despite I change the time, the page is reloaded immediately. I would, after modal closed, that the page was reloaded according the time specified.
Upvotes: 0
Views: 9842
Reputation: 2517
$("#customerAdded").modal("hide").on("hidden.bs.modal", function () {
location.reload();
});
Upvotes: 1
Reputation: 426
You could just fire the location.reload() when you hide your modal:
$("#customerAdded")
.modal("show")
.on("shown.bs.modal", function () {
window.setTimeout(function () {
$("#customerAdded").modal("hide");
location.reload();
}, 5000);
});
Upvotes: 3
Reputation: 3437
Here is the code
$('#customerAdded').on('hidden', function () {
location.reload();
})
Upvotes: 0