fix: ajax 호출 에러 발생시 alert창에 html type 출력 되는 경우 fix

main
minuk926 2 years ago
parent c288e157a4
commit 2b0a866e84

@ -129,6 +129,8 @@
}
});
$( document ).ajaxError(function( event, jqxhr, settings, thrownError ){
console.log('XitIncludeBase::ajaxError >>>>> ', thrownError)
if(settings.dataType==undefined){
//html 문자열을 객체로 변환 후 메시지만 추출
const doc = document.createElement("html");

@ -2,10 +2,10 @@
<meta http-equiv="X-UA-Compatible" content="IE=11" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<%-- <link rel="shortcut icon" type="image/x-icon" href="${ctx}/resources/images/common/favicon.ico"/> --%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<link rel="shortcut icon" type="image/x-icon" href="${ctx}/resources/framework/images/common/favicon.ico"/> --%>
<!-- [JS/CSS] tui Grid -->
<%-- TODO: jquery-ui theme 업무별 적용 --%>
<link rel="stylesheet" type="text/css" href="${ctx}/resources/3rd-party/jquery-ui/1.13.2/themes/redmond/jquery-ui.css" />
@ -62,7 +62,7 @@
<!-- [JS/CSS] ENS Project -->
<%--TODO: 보완 필요 : 공통 ajax 호출 모듈과 통합 필요 --%>
<script type="text/javascript">
var Loading = new Object();
$(document).ready(function(){
@ -77,6 +77,7 @@
}
});
$( document ).ajaxError(function( event, jqxhr, settings, thrownError ){
console.log('BizIncludeBase::ajaxError >>>>> ', thrownError)
if(settings.dataType==undefined){
//html 문자열을 객체로 변환 후 메시지만 추출
var doc = document.createElement("html");
@ -86,8 +87,10 @@
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);
}else{
}else {
alert(jqxhr.responseText);
}
});

Loading…
Cancel
Save