<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Register</title>
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
	<link href='http://fonts.googleapis.com/css?family=Nunito:400,300' rel='stylesheet' type='text/css'>
	<link rel="stylesheet" href="login_style.css">
</head>

<body>
	<script>
	function register() {
		var emailAddress = document.getElementById("mail").value;
		var password = document.getElementById("password").value;
		$.post(
			"register.php",
			{email: emailAddress, password: password},
			function(response) {
				alert(response);
			});
	}
	</script>

	<h1>Register</h1>
	<label for="mail">Email:</label>
	<input type="email" id="mail">
	<label for="password">Password:</label>
	<input type="password" id="password">
	<button type="submit" onclick="register()">Register</button>
</body>
</html>


<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Register</title>
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
	<link href='http://fonts.googleapis.com/css?family=Nunito:400,300' rel='stylesheet' type='text/css'>
	<link rel="stylesheet" href="login_style.css">
</head>

<body>
	<script>
	function register() {
		var emailAddress = document.getElementById("mail").value;
		var password = document.getElementById("password").value;
		$.post(
			"register.php",
			{email: emailAddress, password: password},
			function(response) {
				alert(response);
				if (response.substring(0, 5) == "A new") {
					document.location.href = "login.html";
				}
			});
	}
	</script>

	<h1>Register</h1>
	<label for="mail">Email:</label>
	<input type="email" id="mail">
	<label for="password">Password:</label>
	<input type="password" id="password">
	<button type="submit" onclick="register()">Register</button>
</body>
</html>


Add redirect from reg->login on success
Add redirect from reg->login on success
