Last active
December 11, 2015 06:22
-
-
Save torounit/1138796a3c5a6fccaaad to your computer and use it in GitHub Desktop.
WP REST API で JSONP
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
var list = $('<ul />'); | |
var request = $.getJSON('http://torounit.com/wp-json/wp/v2/posts?_jsonp=?') | |
request.done(function(data){ | |
data.forEach(function(row){ | |
var item = $('<li>'); | |
var content = $('<a />').text(row.title.rendered).attr('href', row.link); | |
item.append(content); | |
list.append(item); | |
}); | |
$('body').append(list); | |
}).fail(function(){ | |
console.log('fail'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment