I am trying to display a message before an auto refresh div. I have created this code for the auto refresh.
$(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 that?
Try this :)
$(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);
});
<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>
setTimeout(function() {
$('#load_status').show();
}, 5000);
$("#pagere").load(location.href + " #pagere");}, 10000);
-this will give you 5 sec of timeout before refresh
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