【发布时间】:2012-12-17 22:20:51
【问题描述】:
我正在尝试将提要显示为列表。当我尝试使用读取器类型为 json 执行此操作时,它工作正常。但是,使用类型为 xml 时,它不起作用。我得到一个例外:
资源被解释为脚本,但使用 MIME 类型 text/xml 传输:“http://feeds.feedburner.com/TechCrunch/?_dc=1345109660600&page=1&start=0&limit=25&callback=Ext.data.JsonP.callback1 ".* *Uncaught SyntaxError: Unexpected token
Ext.define('TestViews.view.RSSFeedView', {
requires:[
'TestViews.view.CommonTitleBar',
'TestViews.view.CommonContainer',
'TestViews.locale.MsgResource'
],
extend: 'Ext.Panel',
xtype: 'Test-rssfeedview',
id:'rssFeedView',
config: {
fullscreen: true,
layout: {
type: 'vbox'
},
autoDestroy: true,
items: [
{
xtype: 'Test-commontitlebar',
title: 'RSS Feed Component'
},
{
xtype: 'list',
id: 'rssFeedList',
title : 'RSS Feed View',
itemId:"testList",
onItemDisclosure: true,
itemTpl: '{title}',
flex: 1,
store:{
model: "TestViews.model.RSSFeedViewModel",
autoLoad: true,
implicitIncludes: true,
proxy: {
type: 'jsonp',
url: 'http://feeds.feedburner.com/TechCrunch/',
reader: {
type: 'xml',
root: 'channel',
record: 'channel'
}
}
},
width: '100%',
autoDestroy: true,
}
]
}
})
型号:
enter Ext.define('TestViews.model.RSSFeedViewModel', {
extend: 'Ext.data.Model',
config: {
fields: [
'title','description'
]
}});
你能告诉我我在这里做错了什么吗?
【问题讨论】:
-
您使用代理类型 jsonp,因此它必须期望 json 作为响应,这就是您收到错误的原因。即使您想使用 xml,然后尝试阅读器类型 ajax。
-
感谢纳雷什的回复。但是,代理类型可以是:Ajax - 根据我的说法,将请求发送到同一域上的服务器或 JsonP - 将请求发送到不同域上的服务器。那么,这里还有什么问题吗?
标签: sencha-touch-2