How to display a message before automatically updating a div using jquery

I am trying to display a message before automatically updating a div. I created this code for automatic updates.

$(document).ready(function() { if setInterval(function() { $("#pagere").load(location.href + " #pagere");}, 10000); }); 

I also need to display a message like "page auto refresh in 3 sec..." . How can i do this?

+5
source share
3 answers

Try the following :)

 $(document).ready(function() { var alertTimeSec = 3000; //alert time in ms var delayTimeSec = 10000; //time delay to refresh in ms setTimeout(function () { alert("3 Sec more") }, (delayTimeSec-alertTimeSec)); setInterval(function() { $("#pagere").load(location.href + " #pagere");}, delayTimeSec); }); 
+2
source
 <script> setInterval(function() { $("#pagere_container").load(location.href + " #pagere"); }, 3000); </script> <div id="pagere_container"> <div id="pagere"> page auto refresh in 3 sec... </div> </div> 
+2
source
 setTimeout(function() { $('#load_status').show(); }, 5000); $("#pagere").load(location.href + " #pagere");}, 10000); 

- this will give you 5 seconds timeout before updating

+2
source