私は保存ボタンがあるjqueryモーダルダイアログを呼び出しています。保存ボタンを押すとajaxが呼び出され、成功するとOKボタンで「データ保存済み!」というアラートボックスが表示されます。アラートボックスを表示した後、jQueryモーダルダイアログをオートクローズします。
"データ保存済み"アラートボックスを閉じた後、以前に呼び出されたモーダルダイアログも自動的に閉じたいと思います。
$("#addFriendButton").click(function() {
$("#addNewFriend").dialog({
title: 'Add a new friend.',
height:'auto',
width:'auto',
modal: true
});
});
//end addFriendButton
$("#saveNewFriendButton").click(function() {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "/api/bb/apiV1/addFriend",
data: formToJSON(),
dataType: "json",
success: function(responseDTO){
displayOKAlertBox(responseDTO.responseMessage);
}
});
});
function displayOKAlertBox(message){
$("#alertMsg").html(message);
$("#alertbox").dialog({
modal: true,
buttons: {
Ok: function() {
$(this).dialog("close");
}
}
});
}
それは働いた。すべてのダイアログが閉じられました。 – cherit