【发布时间】:2011-08-18 14:13:42
【问题描述】:
我与您联系是因为我陷入了僵局。 我尝试使用“ScriptTag”从外部网络服务获取数据,但它不起作用,因为网络服务返回简单的 json 格式(无 JSONP)。
您知道是否有另一种使用 sencha 检索 json 的方法?
var helloWorld = new Ext.Application({
Parking: Ext.regModel('Parking', {
fields:[
{name:'parkingName'},
{name:'latitude'},
{name:'longitude'},
{name:'mapUrl'}
],
}),
launch: function() {
this.tabs = new Ext.TabPanel({
fullscreen: true,
dockedItems: [{xtype:'toolbar', title:'JSON Recovery'}],
tabBar: {
ui: 'light',
layout: {
pack: 'center'
}
},
items: [
{cls:'Page1', title:'Page1', html:'Page1'},
{
cls: 'list',
title: 'Page2',
xtype: 'list',
loadingText: 'Chargement',
itemTpl:'<div>{parkingName}</div>',
store: new Ext.data.Store({
autoLoad:true,
model: 'Parking',
proxy: {
type: 'scripttag',
url : 'http://walker.hotcity.lu/hotcity-central-server/webresources/parking/json?format-version=1_0&client-type=iPhone',
reader: {
type: 'json',
root: 'remoteObject'
},
}
}),
},
],
});
}
});
警告:资源解释为脚本,但使用 MIME 类型 application/json 传输。
错误:未捕获的 SyntaxError:意外令牌:
谢谢。
凯文。
【问题讨论】:
标签: javascript json sencha-touch script-tag