웹마스터 팁
page_full_width">
모듈에서 무조건 JSON/XML 형식으로 출력하기
2015.04.03 20:02
모듈 개발 시 무조건 JSON 또는 XML로 출력을 해야하는 경우가 있습니다.
이 때에는 다음과 같이 코드를 삽입하시면 됩니다.
1 2 3 4 | Context::setRequestMethod( 'JSON' ); // XML은 XMLRPC로 설정해 주세요. Context::setResponseMethod( 'JSON' ); // XML은 XMLRPC로 설정해 주세요. $this ->add( 'test' , 123); |
1.11.2에서도 가능한가요?
1.5.4에서 가능한 소스가 1.11.2에서는 에러가 발생하네요.
jQuery.ajax({
url: url,
type: opt['method'],
timeout: opt['timeout'],
dataType: 'xml',
data: sendString,
async:async,
contentType: 'text/plain',
success: callback_success,
error: callback_error
});