In this post i will show you a various methods and examples to redirect user to another page or URL by using jQuery. It is better to use window.location.replace() instead of window.location.href() because the function do not store the redirected page in the browser history and session. window.location.href() function works on every browser.
//Behave like Http redirect.
// behave like as click on links.
window.location.href = “https://whyblogging.com”;
If you can do without jQuery use window.location = “example.com”; and would like to do by using only jQuery$jq(window).attr(“location”,”example”);
Here is another cool example of jQuery redirect.
var i = $(‘#login’).val();
if (i == ‘login’)
window.location = “login.php”;
window.location = “Logout.php”;