- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HI,
I am trying to use the wordpress rest api into my app, does anybody have any clue where to start?
I have tried using the docs online but the data is not showing up in the emulator.
- Tags:
- HTML5
- Intel® XDK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try this:
$.getJSON("http://wpecom.robbotdev.com/blog/wp-json/wp/v2/posts",function(data){ var len = data.length; for(var i = 0; i<len; i++){ var div_data ="<div><a href='"+data.title.rendered+"'>"+data.content.rendered+"</a></div>"; $(div_data).appendTo("#cand"); } });
Take a look to the returned data value to understand how to parse it.
Regards
Diego
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is my current code, I had not heard of the library you mentioned. I will give it look.
$(document).ready( function () {
$.getJSON("http://wpecom.robbotdev.com/blog/wp-json/wp/v2/posts",function(data)
{
$.each(data.posts, function(i,data)
{
var div_data =
"<div ><a href='"+data.title+"'>"+data.content+"</a></div>";
$(div_data).appendTo("#cand");
});
}
);
return false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try this:
$.getJSON("http://wpecom.robbotdev.com/blog/wp-json/wp/v2/posts",function(data){ var len = data.length; for(var i = 0; i<len; i++){ var div_data ="<div><a href='"+data.title.rendered+"'>"+data.content.rendered+"</a></div>"; $(div_data).appendTo("#cand"); } });
Take a look to the returned data value to understand how to parse it.
Regards
Diego
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page