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

Client side page redirection can be implemented easily in JavaScript. To do this, you are only required to add a line at the head section of your code.
Redirect from one page to another page after click
<!DOCTYPE html>
<html>
<head>
<script>
function Redirect()	{
	window.location="https://www.pythonprogramming.in/";
}
</script>
</head>
<body>
	<form>
		<input type="button" value="Redirect" onclick="Redirect();" />
	</form>
</body>
</html>
Redirect using jQuery
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
<script>
function Redirect()	{
	$(location).attr('href', 'https://www.pythonprogramming.in/');
}
</script>
</head>
<body>
	<form>
		<input type="button" value="Redirect" onclick="Redirect();" />
	</form>
</body>
</html>
Most Helpful This Week