EXTjs:如何从ashx页面读取rss feed到商店? [英] EXTjs: how to read rss feed from ashx page to a store ?
问题描述
我想将一个ashx页面的rss feed提供给EXTjs商店。它与xml页面完美配合。但是当我在一个ashx页面上测试它不会!!!
I want to get the rss feed of an ashx page to an EXTjs store. It works perfectly with a xml page. but when I test it on an ashx page it doesn't !!!
链接: http://met.guc.edu.eg/Feeds/Course.ashx?c=240
var store = Ext.create('Ext.data.Store', {
autoLoad: true,
proxy: {
type: 'ajax',
url: 'http://met.guc.edu.eg/Feeds/Course.ashx?c=240',
reader: {
type: 'xml',
record: 'item',
}
},
fields: ['title','category','pubDateParsed'],
groupField: 'category',
sorters: [{property: 'pubDateParsed', direction: 'DESC'}]
});
推荐答案
您的问题很可能是浏览器因为相同的来源政策,因此阻止您提取Feed。
Your issue is likely that the browser is preventing you from fetching the feed because of the same origin policy.
使用传统的AJAX调用,您只能与您的网页托管的网站进行通信(除非您调整设置以允许)。
With a traditional AJAX call you can only communicate with the site that your page is hosted on (unless you adjust your settings to allow it).
您将需要在您的网站上设置一个代理页面,该页面将获取并回显数据,或者通过类似雅虎!管道到将XML转换为JSON ,并使用动态脚本标签,不具有相同的起始策略限制。
You will either need to setup a proxy page on your site that will fetch and echo the data, or run it through something like Yahoo! Pipes to convert the XML into JSON and use a dynamic script tag, which does not have the same origin policy restrictions.
这篇关于EXTjs:如何从ashx页面读取rss feed到商店?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!