I try to parse a Google Alert
feed via ajax but I get exception. This is what I tried:
$(document).ready(function () {
$.ajax({
url: 'http://www.google.com/alerts/feeds/01662123773360489091/16526224428036307178',
type: 'GET',
dataType: "xml"
}).done(function(xml) {
$.each($("item", xml), function(i, e) {
$("#results").append($("enclosure").attr("url").text() + "<br />");
});
});
});
But I get:
XMLHttpRequest cannot load http://www.google.com/alerts/feeds/01662123773360489091/16526224428036307178. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
Any help?
P.S: I already read several posts about parsing rss feeds via ajax and jquery, but none of them worked for me.
Sorry, you won't be allowed to use cross-domain scripting. See the answers here:
jQuery XML REST Access-Control-Allow-Origin
When looking at Google's headers, they don't provide that option:
Your only alternative is to use your server to fetch the values, then relay the values to your jQuery app.