Redirect to another page in jQuery

How to redirect a user to another page with the help of jQuery.

When you want to redirect the users, it is not necessary to use jQuery. You can employ window.location.replace() instead. It will be the best solution to simulate an HTTP redirect.

Example :

// similar behavior as an HTTP redirect
window.location.replace("http://example.com");

// similar behavior as clicking on a link
window.location.href = "http://example.com";

Otherwise with jQuery, you can use this solution :

$(location).attr('href', 'http://example.com')