jQuery redirect the user from one page to another

jQuery redirect the user from one page to another

Today, We want to share with you jQuery redirect the user from one page to another.
In this post we will show you jQuery redirect the user from one page to another, hear for jQuery redirect the user from one page to another we will give you demo and example for implement.
In this post, we will learn about jQuery Redirect to Another Page on Button Click with an example.

“Simple Use the JavaScript window.location Property”

-jQuery is not a programming language but as a well written simple JavaScript code used in libs.
-jQuery is a simple JavaScript code, which do document(DOM) traversing, event handling and genrate events, Ajax interactions scope and Animations.
-jQuery is a very fast, lightweight data, feature-rich content to client side JavaScript framework.

JQuery Code to redirect a page or URL.

Redirecting a web page simple means, taking user to send new location.Other Means “SendRedirect and Forward Methods”

 var url = "https://www.pakainfo.com";
$(location).attr('href',url);

Redirect to another page in JavaScript-Example

jQuery redirection and response to return http response simple status code success: 200 OK.

    
    
    
    
    Redirect to another page in JavaScript - pakainfo.com
    
    
    
        

JavaScript – For example:

jQuery is not required, and simple used to window.location.replace(…) will best solution on simulate an HTTP page redirect.

//  HTTP redirect
window.location.replace("https://www.pakainfo.com");

//  clicking on a link
window.location.href = "https://www.pakainfo.com";

index.html


The JQuery code : 3- Examples

1. Using window.location.replace

$(document).ready(function () {
    $("#redirect").click(function () {
    window.location.replace("https://www.pakainfo.com"); //page will redirect to pakainfo.com   
 })

2. Using window.location.href

$(document).ready(function () {
      $("#redirect").click(function () {
          window.location.href ="https://www.pakainfo.com";
		  //page will redirect to pakainfo.com 
      })
})

3. Using $(location).attr

 $(document).ready(function () {
        $("#redirect").click(function () {
           var url = "https://www.pakainfo.com"
           $(location).attr('href', url);
		   //page will redirect to pakainfo.com 
         })          
  })

View Demo

We hope you get an idea about jQuery redirect the user from one page to another
We would like to have feedback on my Information blog .
Your valuable any feedback, Good question, Inspirational Quotes, or Motivational comments about this article are always welcome.
If you liked this post, Please don’t forget to share this as Well as Like FaceBook Page.

We hope This Post can help you…….Good Luck!.

Leave a Comment