we will learn redirect in javascript, If you are looking for how to redirect to another page in jquery after 5 seconds then I will give you a simple example to redirect to URL after 2 seconds, 3 seconds, 5 seconds, or any specific time in jquery. we will use setTimeout() for redirect to URL after 5 seconds in jquery.
$("button").click(function(){
$(this).text('Redirecting After 2 Seconds................');
var delay = 2000;
var url = 'https://www.phpcodingstuff.com/'
setTimeout(function(){ window.location = url; }, delay);
})
Read More: https://www.phpcodingstuff.com/blog/redirect-to-another-page-after-5-seconds.html
Top comments (0)