问题
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 !!!
link: 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'}]
});
回答1:
Your issue is likely that the browser is preventing you from fetching the feed because of the same origin policy.
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).
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.
回答2:
I think there are some filter, that prevent access.
So, I can ping
met.guc.edu.eg. nslookup
said that met.guc.edu.eg has ip: 62.241.151.180
... but http:/62.241.151.180/Feeds/Course.ashx?c=240
returns 404.
I even cann't connect to it via telnet to get response without browser.
When I try it from ExtJS code I get Error 403.
回答3:
I think you need to have the proxy as:
proxy: {
type: 'ajax',
url: 'http://met.guc.edu.eg/Feeds/Course.ashx?c=240',
reader: {
type: 'xml',
root: 'channel',
record: 'item'
}
来源:https://stackoverflow.com/questions/7135965/extjs-how-to-read-rss-feed-from-ashx-page-to-a-store