XE exec_json 응답 안드로이드 크롬 오류
CMS/프레임워크 | XE 1.x |
---|---|
개발 언어 | PHP 7.1 |
XE버그인지 모르겠습니다. 아래 도움을 받아 exec_json을 사용하여 모듈의 함수가 실행되고 함수에서 보내는 콜백을 잘 처리할 수 있게 되었습니다.
그런데 안드로이드 크롬의 경우 응답 값 출력이 안됩니다.
ajax관련 문서에서는 async :false 관련 내용도 보입니다.
혹시 exec_json에서도 같은 옵션 사용이 가능한가요?
댓글 8
예제로 제시해주신
https://xetown.com/questions/1223663#comment_1223845
고급메일발송모듈에서 안드로이드 크롬에서 테스트 메일을 발송해 보면 결과 메시지가 출력이 됩니다. 여기에서는 alert이 아닌 레이어로 가려졌던 영역이 노출되면서 보이게 처리 한 듯 합니다.
jQuery(document).ready(function($) {
if(window.exec_json === void 0) {
alert('exec_json function is missing.');
}
if(!jQuery('.pointplus_dog114').length) {
alert('No node found.');
}
jQuery('.pointplus_dog114').click(function() {
alert('click');
exec_json('portalpoint.dispPortalpointIndex', {
title: 'pointplus_dog114'
}, function(response) {
alert(response);
}, function(error){
alert('Error: '+error);
});
});
});
</script>
일단 테스트 값을 저렇게 해보시구 어느 과정에서 찐빠가 났는지 체크해보시면 될 것 같습니다.
만약 아무런 알림창이 뜨지 않는다면 jquery가 빠졌을 가능성도 있습니다.
우선 div로 출력하게 구성했습니다.
일관성이 없긴 하지만 새창으로 떠야 하는 경우 사이트 내부링크는 내부에서 뜨는경우 두가지 케이스로 구분되니 나름 규칙이 있어 그냥 div로 유지를 하는 것으로 고민 중입니다. 알림창 div 디자인은 좀더 이쁘게 꾸며 보려구요.
사이트에 있는
exec_json('portalpoint.dispPortalpointIndex',{title:'pointplus_dog114'},function(response) {$("#result_message").html(response.result_message);$('#result_message').show();});
});
위 코드는 제거하시고
$(document).on('click', '.pointplus_dog114', function(){
var $this = $(this);
var href = $this.attr('href');
window.exec_json('portalpoint.dispPortalpointIndex', {
title: 'pointplus_dog114'
}, function(response) {
alert('RetrievedData:' + response);
if(href) {
window.setTimeout(function(){
window.open(href);
}, 0);
}
}, function(error){
alert('Error: '+error);
});
return false;
});
})(window.jQuery);
이걸로 대처하세요.
RetrievedData: 어쩌구저쩌구 나오면 작동이 되는 것이고, 작동이 된다면 response.result_message 로 고치면 됩니다.