我开始玩 Sencha Touch。
因此,我基于其中一个示例构建了一个非常简单的应用程序,只是为了看看它是如何运行的。
基本上,它创建一个 JSON 请求,该请求执行 Last.FM Web 服务以获取用户位置附近的音乐事件。
这是 JSON 代码:
var makeJSONPRequest = function() {
Ext.util.JSONP.request({
url: 'http://ws.audioscrobbler.com/2.0/',
params: {
method: 'geo.getEvents',
location: 'São+Paulo+-+SP',
format: 'json',
callback: 'callback',
api_key: 'b25b959554ed76058ac220b7b2e0a026'
},
callback: function(result) {
var events = result.data.events;
if (events) {
var html = tpl.applyTemplate(events);
Ext.getCmp('content').update(html);
}
else {
alert('There was an error retrieving the events.');
}
Ext.getCmp('status').setTitle('Events in Sao Paulo, SP');
}
})
};
但是每次我尝试运行它时,都会出现以下异常:
Uncaught SyntaxError: Unexpected token :
有人有线索吗?