Returning XML from an AJAX requestfor RSS Feed

OCDSTEVE

New Member
I have a website where I'd like to make a request to the BBC RSS feed to return the latest news. The problem is I get the following error:\[code\]Uncaught SyntaxError: Unexpected token < \[/code\]This is my code:\[code\]var url = 'http://feeds.bbci.co.uk/news/rss.xml';$.ajax({ url : url, dataType : 'jsonp', contentType : 'text/xml', success : function(data) { console.log(data); }});\[/code\]EditHere is my code on my server, as suggested by the answers below:\[code\] public XmlDocument callBBCFeed() { HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://feeds.bbci.co.uk/news/rss.xml"); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); StreamReader sr = new StreamReader(response.GetResponseStream()); string result = sr.ReadToEnd(); XmlDocument doc = new XmlDocument(); doc.LoadXml(result); return doc; }\[/code\]I then call this in my JS code like so:\[code\] var url = 'http://myServer/Global/callBBCFeed'; $.ajax({ url : url, dataType : 'xml', success : function(data) { console.log(data); } });\[/code\]But I get the Same Origin Policy Error
 
Back
Top