- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
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.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
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
コピーされたリンク
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
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;
}
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
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
