수정/삭제 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", type : "POST",
url:url, url:url,
data:postData, data:postData,
beforeSend: function() {
$("[id^='btn_']").prop("disabled", true);
$("#btn_modify").text("처리중 . . . . .");
},
success:function(args){ success:function(args){
if(args.status=="error"){ if(args.status=="error"){
alert("<%=localeMessage.getString("common.intizMsg")%>"+args.message); alert("<%=localeMessage.getString("common.intizMsg")%>"+args.message);
@@ -659,7 +663,11 @@ $(document).ready(function() {
}, },
error:function(e){ error:function(e){
alert(e.responseText); alert(e.responseText);
} },
complete: function() {
$("[id^='btn_']").prop("disabled", false);
$("#btn_modify").text("수정");
}
}); });
}); });
$("#btn_clone,#btn_clone_new").click(function(){ $("#btn_clone,#btn_clone_new").click(function(){
@@ -696,6 +704,10 @@ $(document).ready(function() {
type : "POST", type : "POST",
url:url, url:url,
data:postData, data:postData,
beforeSend: function() {
$("[id^='btn_']").prop("disabled", true);
$("#btn_clone").text("처리중 . . . . .");
},
success:function(args){ success:function(args){
alert("<%=localeMessage.getString("common.croneMsg")%>"); alert("<%=localeMessage.getString("common.croneMsg")%>");
//goNav(returnUrl);//LIST로 이동 //goNav(returnUrl);//LIST로 이동
@@ -715,7 +727,11 @@ $(document).ready(function() {
alert(error); alert(error);
} }
} }
} },
complete: function() {
$("[id^='btn_']").prop("disabled", false);
$("#btn_clone").text("복제");
}
}); });
}); });
$("#btn_delete").click(function(){ $("#btn_delete").click(function(){
@@ -726,6 +742,10 @@ $(document).ready(function() {
type : "POST", type : "POST",
url:url, url:url,
data:postData, data:postData,
beforeSend: function() {
$("[id^='btn_']").prop("disabled", true);
$("#btn_delete").text("처리중 . . . . .");
},
success:function(args){ success:function(args){
if(args.status=="error"){ if(args.status=="error"){
alert("<%=localeMessage.getString("common.intizMsg")%>"+args.message); alert("<%=localeMessage.getString("common.intizMsg")%>"+args.message);
@@ -736,7 +756,11 @@ $(document).ready(function() {
}, },
error:function(e){ error:function(e){
alert(e.responseText); alert(e.responseText);
} },
complete: function() {
$("[id^='btn_']").prop("disabled", false);
$("#btn_delete").text("삭제");
}
}); });
}else{ }else{
return false; return false;
@@ -867,6 +867,10 @@
type: "POST", type: "POST",
url:url, url:url,
data: postData, data: postData,
beforeSend: function() {
$("[id^='btn_']").prop("disabled", true);
$("#btn_modify").text("처리중 . . . . .");
},
success:function(message){ success:function(message){
alert("저장 되었습니다. \n\n[실시간 반영 결과]\n"+JSON.stringify(message)); alert("저장 되었습니다. \n\n[실시간 반영 결과]\n"+JSON.stringify(message));
if (typeof callback === 'function') { if (typeof callback === 'function') {
@@ -877,6 +881,10 @@
}, },
error:function(xhr, status, errorMsg){ error:function(xhr, status, errorMsg){
alert(JSON.parse(xhr.responseText).errorMsg); alert(JSON.parse(xhr.responseText).errorMsg);
},
complete: function() {
$("[id^='btn_']").prop("disabled", false);
$("#btn_modify").text("수정");
} }
}); });
} }
@@ -936,6 +944,11 @@
type : "POST", type : "POST",
url:url, url:url,
data:postData, data:postData,
beforeSend: function() {
$("[id^='btn_']").prop("disabled", true);
$("#btn_delete").text("처리중 . . . . .");
},
success:function(args){ success:function(args){
alert("삭제 되었습니다."); alert("삭제 되었습니다.");
goNav(returnUrl);//LIST로 이동 goNav(returnUrl);//LIST로 이동
@@ -943,6 +956,10 @@
}, },
error:function(e){ error:function(e){
alert(e.responseText); alert(e.responseText);
},
complete: function() {
$("[id^='btn_']").prop("disabled", false);
$("#btn_delete").text("삭제");
} }
}); });
}); });
@@ -1203,6 +1220,10 @@
newInboundHttpMethod, newInboundHttpMethod,
newInboundRestPath, newInboundRestPath,
}, },
beforeSend: function() {
$("[id^='btn_']").prop("disabled", true);
$("#doCloneInterfaceButton").text("처리중 . . . . .");
},
success: function () { success: function () {
alert("["+orgApiInterfaceId+"] => ["+newBizCode+"]["+newApiInterfaceId+"] 복제 완료."); alert("["+orgApiInterfaceId+"] => ["+newBizCode+"]["+newApiInterfaceId+"] 복제 완료.");
$('#cloneInterfaceModal').modal('hide'); $('#cloneInterfaceModal').modal('hide');
@@ -1210,6 +1231,10 @@
}, },
error: function (e) { error: function (e) {
alert(e.responseText); alert(e.responseText);
},
complete: function() {
$("[id^='btn_']").prop("disabled", false);
$("#doCloneInterfaceButton").text("복제");
} }
}); });
}); });
@@ -194,11 +194,19 @@
type: "POST", type: "POST",
url: url, url: url,
data: postData, data: postData,
beforeSend: function() {
$("[id^='btn_']").prop("disabled", true);
$("#btn_save").text("처리중 . . . . .");
},
success: function () { success: function () {
alert("<%= localeMessage.getString("common.saveMsg") %>"); alert("<%= localeMessage.getString("common.saveMsg") %>");
}, },
error: function (e) { error: function (e) {
alert(e.responseText); alert(e.responseText);
},
complate: function() {
$("[id^='btn_']").prop("disabled", false);
$("#btn_save").text("수정");
} }
}); });
} }
@@ -258,12 +266,20 @@
type: "POST", type: "POST",
url: url, url: url,
data: { cmd: 'DELETE', apiId: $('#apiId').val() }, data: { cmd: 'DELETE', apiId: $('#apiId').val() },
beforeSend: function() {
$("[id^='btn_']").prop("disabled", true);
$("#btn_delete").text("처리중 . . . . .");
},
success: function() { success: function() {
alert("<%= localeMessage.getString("common.deleteMsg") %>"); alert("<%= localeMessage.getString("common.deleteMsg") %>");
window.close(); window.close();
}, },
error: function(e) { error: function(e) {
alert(e.responseText); alert(e.responseText);
},
complate: function() {
$("[id^='btn_']").prop("disabled", false);
$("#btn_delete").text("삭제");
} }
}); });
} }
@@ -276,6 +292,10 @@
cmd: 'GENERATE_SPEC', cmd: 'GENERATE_SPEC',
apiId: $('#apiId').val() apiId: $('#apiId').val()
}, },
beforeSend: function() {
$("[id^='btn_']").prop("disabled", true);
$("#btn_generate_spec").text("처리중 . . . . .");
},
success: function(data) { success: function(data) {
// Update the editors with generated content // Update the editors with generated content
$('#apiRequestSpec').summernote('code', data.requestSpec); $('#apiRequestSpec').summernote('code', data.requestSpec);
@@ -288,6 +308,10 @@
}, },
error: function(e) { error: function(e) {
alert("API 스펙 생성 중 오류가 발생했습니다: " + e.responseText); alert("API 스펙 생성 중 오류가 발생했습니다: " + e.responseText);
},
complate: function() {
$("[id^='btn_']").prop("disabled", false);
$("#btn_generate_spec").text("SPEC 자동 생성");
} }
}); });
} }