This jQuery plugin provides a wrapper arround the WordPress REST API and can be used in any jQuery project.
Simply copy the file into your project and replace YOUR_API_ENDPOINT with the correct URL. e.g. http://www.danillo.nl/wp-json/wp/v2
wp.posts()
.done(function(posts){
// Loop through the posts
$(posts).each(function(){
console.log(post.title.rendered);
console.log(post.content.rendered);
});
})
.fail(function(){
console.log('Oops something went wrong');
});
}
For a more extended documentation go to the WordPress REST API Reference documentation at http://v2.wp-api.org/reference/
wp.posts([params])
wp.pages([params])
wp.media([params])
wp.comments([params])
wp.categories([params])
wp.taxonomies([params])
wp.tags([params])
wp.users([params])