Page Redirect after X seconds wait using jQuery

Today, We want to share with you Page Redirect after X seconds wait using jQuery.In this post we will show you jQuery redirect on page load, hear for how to redirect page after some time in jQuery we will give you demo and example for implement.In this post, we will learn about jQuery redirect after 5 seconds with countdown with an example.

Page Redirect after X seconds wait using jQuery

There are the Following The simple About Page Redirect after X seconds wait using jQuery Full Information With Example and source code.

As I will cover this Post with live Working example to develop redirect page after 5 seconds jQuery, so the some major files and Directory structures for this example is following below.

  • index.html
Read Also:  How to print to console using javascript?

Redirect page after delay using jQuery

index.html

This is where I will make a simple HTML form and PHP server side source code for our web application. To make the forms simply all souce code copy and write it into your any text editor Like Notepad++, then save file it as index.html.

jQuery Redirect to New page after delay 5(x) seconds

<br />
<br />
<h2>Redirect page after delay using jQuery</h2>
<div id="preview">
You will be redirected after <span id="liveflgas"></span> countrdown.
</div>


$(function () {
    $("#myliveBtn").click(function () {
        var countrdown = 5;
        $("#preview").show();
        $("#liveflgas").html(countrdown);
        setInterval(function () {
            countrdown--;
            $("#liveflgas").html(countrdown);
            if (countrdown == 0) {
                $("#preview").hide();
                window.location = "//www.pakainfo.com/";
            }
        }, 1000);
    });
});

Redirect page after delay using JavaScript

HTML Part

<h2>Redirect page after delay using JavaScript</h2>
<div id="preview"></div>

JavaScript Part

function delayRedirect(){
    document.getElementById('preview').innerHTML = 'Please wait you\'ll be redirected after <span id="livecount">5</span> seconds....';
    var liveflgas = 5;
    setInterval(function(){
        liveflgas--;
        document.getElementById('livecount').innerHTML = liveflgas;
        if (liveflgas == 0) {
            window.location = 'https://www.infinityknow.com'; 
        }
    },1000);
}

Page Redirect after X seconds wait using jQuery – Output

Page Redirect after X seconds wait using jQuery
Page Redirect after X seconds wait using jQuery
Angular 6 CRUD Operations Application Tutorials

Read :

Read Also:  PHP Login logout example with session

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Page Redirect after X seconds wait using jQuery.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.