수정/삭제 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
@@ -649,6 +649,10 @@ $(document).ready(function() {
type : "POST",
url:url,
data:postData,
beforeSend: function() {
$("[id^='btn_']").prop("disabled", true);
$("#btn_modify").text("처리중 . . . . .");
},
success:function(args){
if(args.status=="error"){
alert("<%=localeMessage.getString("common.intizMsg")%>"+args.message);
@@ -659,7 +663,11 @@ $(document).ready(function() {
},
error:function(e){
alert(e.responseText);
}
},
complete: function() {
$("[id^='btn_']").prop("disabled", false);
$("#btn_modify").text("수정");
}
});
});
$("#btn_clone,#btn_clone_new").click(function(){
@@ -696,6 +704,10 @@ $(document).ready(function() {
type : "POST",
url:url,
data:postData,
beforeSend: function() {
$("[id^='btn_']").prop("disabled", true);
$("#btn_clone").text("처리중 . . . . .");
},
success:function(args){
alert("<%=localeMessage.getString("common.croneMsg")%>");
//goNav(returnUrl);//LIST로 이동
@@ -715,7 +727,11 @@ $(document).ready(function() {
alert(error);
}
}
}
},
complete: function() {
$("[id^='btn_']").prop("disabled", false);
$("#btn_clone").text("복제");
}
});
});
$("#btn_delete").click(function(){
@@ -726,6 +742,10 @@ $(document).ready(function() {
type : "POST",
url:url,
data:postData,
beforeSend: function() {
$("[id^='btn_']").prop("disabled", true);
$("#btn_delete").text("처리중 . . . . .");
},
success:function(args){
if(args.status=="error"){
alert("<%=localeMessage.getString("common.intizMsg")%>"+args.message);
@@ -736,7 +756,11 @@ $(document).ready(function() {
},
error:function(e){
alert(e.responseText);
}
},
complete: function() {
$("[id^='btn_']").prop("disabled", false);
$("#btn_delete").text("삭제");
}
});
}else{
return false;
@@ -867,6 +867,10 @@
type: "POST",
url:url,
data: postData,
beforeSend: function() {
$("[id^='btn_']").prop("disabled", true);
$("#btn_modify").text("처리중 . . . . .");
},
success:function(message){
alert("저장 되었습니다. \n\n[실시간 반영 결과]\n"+JSON.stringify(message));
if (typeof callback === 'function') {
@@ -877,6 +881,10 @@
},
error:function(xhr, status, errorMsg){
alert(JSON.parse(xhr.responseText).errorMsg);
},
complete: function() {
$("[id^='btn_']").prop("disabled", false);
$("#btn_modify").text("수정");
}
});
}
@@ -936,6 +944,11 @@
type : "POST",
url:url,
data:postData,
beforeSend: function() {
$("[id^='btn_']").prop("disabled", true);
$("#btn_delete").text("처리중 . . . . .");
},
success:function(args){
alert("삭제 되었습니다.");
goNav(returnUrl);//LIST로 이동
@@ -943,6 +956,10 @@
},
error:function(e){
alert(e.responseText);
},
complete: function() {
$("[id^='btn_']").prop("disabled", false);
$("#btn_delete").text("삭제");
}
});
});
@@ -1203,6 +1220,10 @@
newInboundHttpMethod,
newInboundRestPath,
},
beforeSend: function() {
$("[id^='btn_']").prop("disabled", true);
$("#doCloneInterfaceButton").text("처리중 . . . . .");
},
success: function () {
alert("["+orgApiInterfaceId+"] => ["+newBizCode+"]["+newApiInterfaceId+"] 복제 완료.");
$('#cloneInterfaceModal').modal('hide');
@@ -1210,6 +1231,10 @@
},
error: function (e) {
alert(e.responseText);
},
complete: function() {
$("[id^='btn_']").prop("disabled", false);
$("#doCloneInterfaceButton").text("복제");
}
});
});
@@ -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 자동 생성");
}
});
}