var counter = 10;
setInterval(function() {
counter--;
if (counter >= 0) {
span = document.getElementById("count");
span.innerHTML = counter;
}
// Display 'counter' wherever you want to display it.
if (counter === 0) {
get_location(); // write ajax code here
counter = 10;
//clearInterval(counter); //to stop recount down uncomment this line code
}
}, 1000);
<div data-role="fieldcontain">
<h3>Next Update in <span id="count"></span> secs</h3>
</div>
setInterval(function() {
counter--;
if (counter >= 0) {
span = document.getElementById("count");
span.innerHTML = counter;
}
// Display 'counter' wherever you want to display it.
if (counter === 0) {
get_location(); // write ajax code here
counter = 10;
//clearInterval(counter); //to stop recount down uncomment this line code
}
}, 1000);
<div data-role="fieldcontain">
<h3>Next Update in <span id="count"></span> secs</h3>
</div>
0 comments:
Post a Comment