【发布时间】:2023-04-01 15:43:02
【问题描述】:
Sencha 新手,我正在使用以下代码尝试获取 JSON 数据。由于某种原因,它返回 null,但我知道 URL 正在返回值,因为我在另一个项目中使用它。
// Make the JsonP request
Ext.data.JsonP.request({
url: 'http://xxx.azurewebsites.net/login',
crossDomain: true,
type: "GET",
dataType: "json",
callbackKey: 'jsoncallback',
callback: function(successful, data ) {
alert( JSON.stringify(data) );
}
});
谁能指出我错过了什么。
【问题讨论】:
-
您的网址返回了什么?请记住,JSON-P 需要在函数中返回数据,使用
callbackKey作为函数名。