Saturday, January 31, 2009

[jQuery] $.ajax Feed Aggregator

I was curious if someone could help me manipulate some code. Im still
pretty new to jQuery and this is over my head.

$(function() {

$.ajax({
type: "GET",
url: "http://www.msn.com/rss/alsoonmsn.aspx",
dataType: "xml",
success: function(rss) {
strRSS = "<h4>" + $("/rss/channel/title",rss).text() + "</
h4>";
$("/rss/channel/item/title:lt(5)",rss).each(function(i) {
strRSS += "<li><a href='";
strRSS += $("/rss/channel/item/link:eq(" + i +
")",rss).text();
strRSS += "'>";
strRSS += $(this).text();
strRSS += "</a><br />";
strRSS += ($("/rss/channel/item/description:eq(" + i +
")",rss).text()).substring(0,200) + "...</li>";
});
$("#feed_me").html(strRSS);
}
});

});

Pretty much what im trying to do is have it to where the <li> has
something like this: <li onclick="location.href='storyurlhere';">

Thanks a million.

No comments: