2017  Kodetalk | Feedback | Privacy Policy | Terms | About

Redirect a page using jQuery?

How do I redirect the user from one page to another using jQuery?

There are two ways by which you can achieve that

If you want to simulate someone clicking on a link, use location.href

Example :

// similar behavior as an HTTP redirect


 If you want to do an HTTP redirect, use location.replace.

Example :

// similar behavior as clicking on a link

window.location.href = "http://www.google.com";

Answer is