Skip to content

Instantly share code, notes, and snippets.

@fredrick

fredrick/feed.html

Created Sep 23, 2011
Embed
What would you like to do?
RSS Widget
<div class="feed">
<script type="text/javascript">
(function(url, callback) {
jQuery.ajax({
url: document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&callback=?&q=' + encodeURIComponent(url),
dataType: 'json',
success: function(data) {
callback(data.responseData.feed);
}
});
})('http://news.ycombinator.com/rss', function(feed){ // Change to desired URL
var entries = feed.entries;
for (var i = 0; i < entries.length; i++) {
jQuery('.feed > ul').append('<li><a href="' + entries[i].link + '">' + entries[i].title + '</a></li>');
}
});
</script>
<!--Change me-->
<h4>Hacker News</h4>
<ul></ul>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.