Created
September 23, 2011 14:54
-
-
Save fredrick/1237561 to your computer and use it in GitHub Desktop.
RSS Widget
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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