I'm new to RSS parsing and am having trouble using jQuery to access feeds. I tried (and would like to) use $.get()
but that got me less than this. (This at least triggers the error.) What am I doing wrong?
function GetFedFeeds(){
$.ajax({
type: 'GET',
url: 'http://www.federalreserve.gov/feed/press_enforcement.xml',
dataType: 'xml',
success: function(xml){
$(xml).find('item').each( function(){
var t = $(this).find('title').text();
$('#content').append(t);
});
},
error: function() { alert('RSS Error'); }
});
}
It seems you are trying for Cross-domain, which will won't work.
JSONP is the approach for cross-domain request.
Use this, url
is the RSS feed source URL
$.ajax({
url: document.location.protocol + '//ajax.googleapis.com/ajax/service/feed/load?v=1.0&num=10&callback=?&q=' + encodeURIComponent(url),
dataType: 'json',
success: function(data) {
//YOUR DATA
}
});