Pull content from RSS Feed with jQuery
html, javascript, jquery, rss
Solution
I took input from Clarkson's ideas and came up with
$.ajax({
type: 'GET',
url: 'feed.xml',
dataType: 'xml',
success: function (xml) {
$(xml).find("item").each(function () {
var title = $(this).find("title").text();
var description = $(this).find("description").text();
var linkUrl = $(this).find("link_url").text();
var link = "<a href='" + linkUrl + "' target='_blank'>Read More<a>";
$('#feedContainer').append('<article><h3>'+title+'</h3><p>'+description+link+'</p>');
});
}
});
I then hosted the file on a local web server which allowed me to access it as it removed the restrictions placed by the web browser.
Problem
I have a basic HTML template: ``` <article> <h3>Being a Freelance Designer</h3> <p>Etiam porta sem malesuada magna euismod... <a href="#">Read more</a> </p> </article> ``` I have an RSS feed, http://www.justcode.us/feed, and I am trying to pull the title and content of each RSS entry and create an `<article>`. Each `<article>` is for an RSS entry, with the `<h3>` being the title and the `<p>` being the body. The `<a>` links back to the page article. Can anyone help? Here is a list of plugins that won't work as I need to load a feed from an external URL (These all use AJAX): - http://jsfiddle.net/SpYk3/Pp44S/ - jFeed - jQuery Feeds