I have been reading around this subject all morning, but I am still confused by the results.
From what I understand JQuery .ajax .get should not work cross browser using datatype="xml", however the following rs feed does work
var rssurl = 'http://gdata.youtube.com/feeds/base/videos/-/trees?orderby=published&alt=rss';
Yet when I try and call another feed it doesn't work. It gives a parseerror.
var rssurl = 'http://api.flickr.com/services/feeds/photos_public.gne?tags=trees&format=rss2'
Now this feed that doesn't work, does work, when I copy it locally and call it. Which is why I think it is a crossdomain issue.
Also, when viewing in Fiddler, I can see the feed is actualy downloaded. Which I find strange as why would this hapen if it is a crossdomain call, surely it would stop before the feed is pulled?
Below the code to pull the feed.
$.ajax({
type: "GET",
url: rssurl,
dataType: "xml",
success: function(data, textStatus, jqXHR) {
document.write("got the feed: "+ textStatus+"
");
var $xml = $(data);
$xml.find("item").each(function() {
var $this = $(this),
document.write( $this.find("title").text() );
});
},
error: function(jqXHR, textStatus, errorThrown){
alert('failure');
console.log('status: ' + textStatus);
if (textStatus == 'error')
console.log(errorThrown);
}
);
So onto my questions:
- Why would I be able to make a cross-domain call to one feed and not another; shouldn't both be banned?
- If the 2nd feed did contain erros, why would it work locally?
- arghhhhhhhhhhhhhhh
cheers