Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

refresh current page after set timeout function call

Is there a way to refresh page after setTimeout() function call is executed?

here is the code of setTimeout function call:

setTimeout(function(){
     $('#alert-success').slideUp('slow').fadeOut();
}, 5000);
like image 524
Arish Avatar asked Aug 29 '12 08:08

Arish


2 Answers

try with

setTimeout(function(){
     $('#alert-success').slideUp('slow').fadeOut(function() {
         window.location.reload();
         /* or window.location = window.location.href; */
     });
}, 5000);
like image 102
Fabrizio Calderan Avatar answered Oct 21 '22 06:10

Fabrizio Calderan


You could do like this: (when you use .slideUp, there is no need to use .fadeOut)

setTimeout(function() {
   $('#alert-success').slideUp('slow', window.location.reload);
}, 5000);
like image 31
xdazz Avatar answered Oct 21 '22 04:10

xdazz