수정/삭제 AJAX 요청 시 버튼 비활성화 후 응답 시 재활성화

This commit is contained in:
daekuk
2025-11-25 11:21:22 +09:00
parent aaf13a0579
commit 48fe41794b
3 changed files with 76 additions and 3 deletions
@@ -194,11 +194,19 @@
type: "POST",
url: url,
data: postData,
beforeSend: function() {
$("[id^='btn_']").prop("disabled", true);
$("#btn_save").text("처리중 . . . . .");
},
success: function () {
alert("<%= localeMessage.getString("common.saveMsg") %>");
},
error: function (e) {
alert(e.responseText);
},
complate: function() {
$("[id^='btn_']").prop("disabled", false);
$("#btn_save").text("수정");
}
});
}
@@ -258,12 +266,20 @@
type: "POST",
url: url,
data: { cmd: 'DELETE', apiId: $('#apiId').val() },
beforeSend: function() {
$("[id^='btn_']").prop("disabled", true);
$("#btn_delete").text("처리중 . . . . .");
},
success: function() {
alert("<%= localeMessage.getString("common.deleteMsg") %>");
window.close();
},
error: function(e) {
alert(e.responseText);
},
complate: function() {
$("[id^='btn_']").prop("disabled", false);
$("#btn_delete").text("삭제");
}
});
}
@@ -276,6 +292,10 @@
cmd: 'GENERATE_SPEC',
apiId: $('#apiId').val()
},
beforeSend: function() {
$("[id^='btn_']").prop("disabled", true);
$("#btn_generate_spec").text("처리중 . . . . .");
},
success: function(data) {
// Update the editors with generated content
$('#apiRequestSpec').summernote('code', data.requestSpec);
@@ -288,6 +308,10 @@
},
error: function(e) {
alert("API 스펙 생성 중 오류가 발생했습니다: " + e.responseText);
},
complate: function() {
$("[id^='btn_']").prop("disabled", false);
$("#btn_generate_spec").text("SPEC 자동 생성");
}
});
}