ユーザーがボタンをクリックすると、そのアクションを確認するダイアログ ボックスが表示され、サーバー上で削除を行った後
@RequestMapping(method = RequestMethod.GET, value = "/secure/admin/deleteuser/{username}")
public String deleteUser(Model model, @PathVariable("username") String username, BindingResult result) {
...
}
$("#deleteUserConfirm").dialog({
autoOpen: false,
resizable: false,
height: 180,
modal: true,
buttons: {
"Delete user": function() {
var username = $(this).data('username');
var url = "/secure/admin/deleteuser/" + username;
//server call to delete this user
$.ajax({
type: "GET",
url: url
}).done(function() {
alert("second success");
}).fail(function() {
alert("error");
}).always(function() {
alert("finished");
});
$(this).dialog("close");
},
Cancel: function() {
$(this).dialog("close");
}
}
});
サーバーにアクセスすることはありません... 2 番目の成功アラートと完了アラートが表示されます。エラーはありません
サーバーでやってみた
@RequestMapping(method = RequestMethod.GET, value = "/secure/admin/deleteuser")
public String deleteUser(Model model, @RequestParam("username") String username, BindingResult result) {
}
jsで
$.ajax({
type: "GET",
url: "/secure/admin/deleteuser",
data: {username: "RenewalRate2"}
}).done(function() {
alert("second success");
}).fail(function() {
alert("error");
}).always(function() {
alert("finished");
});
私はクロームで次へのリクエストを見ます:
`http://localhost:8084/secure/admin/deleteuser?username=RenewalRate2`
そのステータスでは200です...しかし、サーバーでは何も行われていません.....