Last active
August 29, 2015 14:24
-
-
Save semicolon/1bd7ce2768bcf9abe001 to your computer and use it in GitHub Desktop.
ウェブページにJSONPフィード内容を表示するための JavaScript サンプル
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
$(function() { | |
var blogfeed = 'http://example.com/jsonp.feed?'; | |
$.getJSON(blogfeed, function(data) { | |
for (var key in data) { | |
var link = data[key]['link']; | |
var title = data[key]['title']; | |
var date = new Date(Date.parse(data[key]['date'])); | |
var y = date.getFullYear(); | |
var m = date.getMonth() + 1; | |
var d = date.getDate(); | |
var dates = '<span class="date">' + y + '年' + m + '月' + d + '日: </span>'; | |
$('#blog-entry-list').append('<li>' + dates + '<a href="' + link + '">' + title + '</li>').hide().fadeIn(500); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment