Created
April 17, 2012 16:13
-
-
Save ds729/2407231 to your computer and use it in GitHub Desktop.
jQueryでRSS取得(クロスドメイン)
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
//http://jsdo.it/ds.style729/pkv6 | |
//google+の場合は下記アドレスのRSSのあとにidを入れれば取れる | |
//http://gplus.slfeed.net/RSS2/112166094088653039891 | |
google.load("feeds", "1"); | |
var rssFeedUrl = "http://feedblog.ameba.jp/rss/ameblo/ske48official/rss20.xml"; | |
$.gFeed = function(url, options, callback){ | |
var opt = $.extend({q: url, v: '1.0', num: 10}, options); | |
if (!opt.q) return false; | |
$.getJSON('http://ajax.googleapis.com/ajax/services/feed/load?callback=?', | |
opt, | |
function(data){ | |
if (data) callback.call(this, data.responseData.feed); | |
} | |
); | |
} | |
$(function() { | |
$('#feed').append('<ul/>'); | |
$.gFeed(rssFeedUrl, {}, | |
function(feed){ | |
$(feed.entries).each(function() { | |
$('#feed ul').append("<li>"+this.title); | |
}); | |
} | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment