私はSenchaTouchで少し遊び始めました。
そこで、例の1つに基づいて、実際にどのように動作するかを確認するために、非常に単純なアプリケーションを作成しました。
基本的に、Last.FMWebサービスを実行してユーザーの場所の近くで音楽イベントを取得するJSONリクエストを作成します。
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:予期しないトークン:
誰か手がかりがありますか?