0
I’m using the blogger, and I need to "generate" the categories of each post.
function posts(json) {
for (var i = 0; i < 11; i++) {
var post = json.feed.entry[i];
var postLabels = [];
}
for (var b = 0; b < post.category.length; b++) {
postLabels.push(post.category[b].term);
}
document.write('<span>'+postLabels.join(', ')+'</span>');
}
}
It works, but shows only the first category of each post. I need you to display all, as I do?
"published": {
"$t": "2014-09-06T22:43:00.001-07:00"
}
,
"updated": {
"$t": "2018-04-15T13:24:56.217-07:00"
}
,
"category":[ {
"scheme": "http://www.blogger.com/atom/ns#", "term": "Car"
}
,
{
"scheme": "http://www.blogger.com/atom/ns#", "term": "Gallery"
}
,
{
"scheme": "http://www.blogger.com/atom/ns#", "term": "People"
}
,
{
"scheme": "http://www.blogger.com/atom/ns#", "term": "Technology"
}
,
{
"scheme": "http://www.blogger.com/atom/ns#", "term": "Teste"
}
],
"title": {
"type": "text", "$t": "Photodune Vintage Car"
}
You have already tried console.log(json); to verify that all information is coming in?
– Wictor Chaves
Yes. There’s something missing in the code, I believe it’s not difficult, I’m really beginner.
– Ericki
Edit the question and put the return of the.log console to make it easy to answer.
– Wictor Chaves