solvit.io

Redirect the user to another web page using jQuery

Solution #1
var url = 'http://...';
$(location).attr('href', url);
Example
$(location).attr('href', 'http://example.org');
Solution #2

You don't need jQuery to redirect the user to another web page. This pure JavaScript code is equivalent to the previous solution:

window.location.replace('http://example.org');
Find more solutions about: , , , ,