fix: ajax error 처리 fix

main
minuk926 2 years ago
parent 751c775e05
commit 7570d050c6

@ -4,7 +4,7 @@
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<link rel="shortcut icon" type="image/x-icon" href="${ctx}/resources/framework/images/common/favicon.ico"/> --%>
<link rel="shortcut icon" type="image/x-icon" href="${ctx}/resources/framework/images/common/favicon.ico"/>
<!-- [JS/CSS] tui Grid -->
<%-- TODO: jquery-ui theme 업무별 적용 --%>
@ -87,10 +87,28 @@
msg = jqxhr.responseText;
alert(msg);
}else if(settings.dataType=='json'){
//error 발생시 html type인 경우
if(settings.contentType=='application/x-www-form-urlencoded') return document.write(jqxhr.responseText);
alert(jqxhr.responseText);
//TODO: 에러처리 화면 깨지는 경우 체크해야 함
//error 발생시 html type인 경우 반영
//try{
//const jsonObject = JSON.stringify(jqxhr.responseText);
//if(typeof jsonObject === 'object') alert(jsonObject.message)
//else return document.write(jqxhr.responseText);
if(jqxhr.responseJSON?.message){
alert(jqxhr.responseJSON?.message);
return false;
}
else {
document.write(jqxhr.responseText);
return false;
}
//}catch{
// document.write(jqxhr.responseText);
// return false;
//}
}else {
console.log('??? alert(jqxhr.responseText) 으로 처리 했는데 .... document.write(jqxhr.responseText)로 처리해야 하지 않을까????? 확인이 필요');
alert(jqxhr.responseText);
}
});

Loading…
Cancel
Save