The below jQuery code uses JavaScript setInterval which executes a function, over and over again, at specified time intervals. So all is required is to set the setInterval as 1 second and then minus the counter from actual time interval. When it reach to zero second , simply redirect to specific path.
Related Post:
- How to redirect user to another web page using jQuery
- Different ways to refresh or reload page using jQuery
- jQuery : How to force browser to reload the images
$(document).ready(function () {Feel free to contact me for any help related to jQuery, I will gladly help you.
window.setInterval(function () {
var iTimeRemaining = $("#spnSeconds").html();
iTimeRemaining = eval(iTimeRemaining);
if (iTimeRemaining == 0) {
window.location.href = "http://jquerybyexample.blogspot.com/";
}
else {
$("#spnSeconds").html(iTimeRemaining - 1);
}
}, 1000);
});
No comments:
Post a Comment