ここで電子メールには、私は、エラー412 を取得していますし、私のコードを見ている理由JavaScriptでAJAXポストを使用してパスワードを変更する方法を
function Submit() {
var objectData =
{
"emailId": $("#emailId").val(),
"password": $("#password").val()
};
var objectDataString = JSON.stringify(objectData);
console.log(objectDataString);
localStorage.setItem("email",$("#emailId").val());
$.ajax({
type: "POST",
url: "http://localhost:8080/feasthunt/common/changePassword",
contentType: "application/json; charset=utf-8",
data: objectDataString,
dataType: "json",
success: function (data,status,xhr) {
console.log(objectDataString);
alert('success');
},
error: function() {
alert('error');
}
});
}
<div class="container">
\t \t \t
\t \t \t <div class="col-md-4 col-md-offset-4">
\t \t \t \t <form role="form" id="form">
\t \t \t \t \t <div class="heading"><h3 class="text-center">Change Password</h3></div>
\t \t \t \t \t
\t \t \t \t \t <div class="form-group" class="hidden" style="display:none">
\t \t \t \t \t \t <label for="emailId">EmailId</label>
\t \t \t \t \t \t <input type="emailId" class="form-control" id="emailId" placeholder="emailId" required />
\t \t \t \t \t </div>
\t \t \t \t \t <div class="form-group">
\t \t \t \t \t \t <label for="pwd">Old Password:</label>
\t \t \t \t \t \t <input type="password" class="form-control" id="password" placeholder="Old Password" required />
\t \t \t \t \t </div>
\t \t \t \t \t <div class="form-group">
\t \t \t \t \t \t <label for="pwd">New Password:</label>
\t \t \t \t \t \t <input type="password" class="form-control" id="password1" placeholder="New Password" required />
\t \t \t \t \t </div>
\t \t \t \t \t <div class="form-group">
\t \t \t \t \t \t <label for="pwd">Retype New Password:</label>
\t \t \t \t \t \t <input type="password" class="form-control" id="password2" placeholder="Retype New Password" required />
\t \t \t \t \t </div>
\t \t \t \t \t <input class="text-center" type="submit" class="btn btn-default" value="SAVE CHANGES" onclick="Submit()">
\t \t \t \t </form>
\t \t \t </div>
\t \t </div>