내 서버에서 JSon을 가져 오려고합니다. 다음과 같이 API를 호출합니다.Ext.data.jSonP ColdFusion을 사용하는 Sencha API
Ext.data.JsonP.request({
url: 'http://dev.mysite.com/temp.cfm',
callbackKey: 'callback',
timeout: 40000,
params: {
format: 'json'
},
success: function(result, request) {
// Get the weather data from the json object result
var weather = result; console.log('Succ');
},
failure: function(result, request) {
// Get the weather data from the json object result
var weather = result; console.log('Fail');
},
callback: function(result, request) {
// Get the weather data from the json object result
var weather = result; console.log('CallB');
}
});
서버 측으로 Coldfusion을 사용하고 있습니다. 그래서, 난 그저이 일을하고있다 :
다음과 같은 문자열을 반환<cfreturn '#url.callback#({\"LOGINSTATUS\":\"fail\"})'>
:
Ext.data.JsonP.callback1({\"LOGINSTATUS\":\"fail\"})
하지만 내 요청 항상 시간이 초과합니다.
jsonp 요청이있을 때 내부 메커니즘에 의해 정의됩니다. 모든 서버 측에서 반환해야하는 콜백 키는 json 문자열입니다. – dbrin
@DmitryB 좀 더 디버깅을하면 방금 내 요청이 시간 초과됨을 알게되었습니다. 어떤 아이디어가 그 이유 일 수 있습니까? 나는 Timeout : '40000'을 설정하려고 시도했지만 여전히 시간이 초과됩니다. –
서버에 얼마나 많은 시간을 소비합니까? 클라이언트에서 제공 한 것과 똑같이 서버 측에서 콜백 키를 반환하는지 확인하십시오. – dbrin