javascript - jquery redirect with post - How do I redirect to another webpage?

jquery redirect to path / javascript / jquery / redirect

How can I redirect the user from one page to another using jQuery or pure JavaScript?

Peter Mortensen

Answer #1

JavaScript provides you many methods to retrieve and change the current URL which is displayed in browser's address bar. All these methods uses the Location object, which is a property of the Window object. You can create a new Location object that has the current URL as follows..

var currentLocation = window.location;

Basic Structure of a URL


You can use the href property of the Location object.

window.location.href = "";

You can use assign() and replace methods also to redirect to other pages like these



You can change the location object href property using jQuery also like this