After displaying an error notice, I need to redirect to a specified URL after 5 seconds.
First, I utilized Javascript as seen below.
document.ready(window.setTimeout(location.href = "https://www.google.co.in",5000));
However, it is not waiting 5 seconds. Then I googled the problem and discovered that "document.ready()" is called when a document is loaded at the DOM rather than the web browser.
Then I used jQuery's window.load() function, but I still don't get what I want.
$(window).load(function() {
window.setTimeout(window.location.href = "https://www.google.co.in",5000);
});
Could someone kindly tell me what I need to do to wait 5 seconds?