File: /home/imensosw/www/imenso.co/demo/resume-maker/reset-password.php
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
</head>
<body>
<h2>Reset Password</h2>
<br/>
<div id="message"></div>
<br/>
<input type="hidden" name="email" id="email" value="<?php echo $_GET['email']; ?>" />
<input type="password" name="password" placeholder="New Password" id="password" />
<br/>
<input type="password" name="confirm-password" placeholder="Confirm Password" id="confirm-password" />
<br/>
<input type="button" value="Update Password" id="update-password-button"/>
<script>
$(document).ready(function(){
$("#update-password-button").click(function(){
var email = $("#email").val();
var password = $("#password").val();
var confirmPassword = $("#confirm-password").val();
// Returns successful data submission message when the entered information is stored in database.
var dataString = 'password='+ password + '&confirm-password=' + confirmPassword + '&email=' + email;
if(password=='' || confirmPassword == '') {
document.getElementById("message").innerHTML = "Please fill all fields";
}
else if(password != confirmPassword) {
document.getElementById("message").innerHTML = "";
document.getElementById("message").innerHTML = "Password and confirm Password didn't match";
}
else
{
document.getElementById("message").innerHTML = "";
// AJAX Code To Submit Form.
$.ajax({
type: "POST",
url: "ajax-update-password.php",
data: dataString,
cache: false,
dataType: "JSON",
success: function(result){
alert(result.message)
}
});
}
return false;
});
});
</script>
</body>
</html>