105
rated 0 times
[
111]
[
6]
/ answers: 1 / hits: 17451
/ 12 Years ago, mon, august 20, 2012, 12:00:00
category: [{
id: 28,
name: Dogs
},
{
id: 14,
name: Cats
},
{
id: 878,
name: Sheep
}],
I have the above JSON parsed (using .ajax and jsonp as callback) and I would like to join all the values of name into a string. i.e. Dogs, Cats, Sheep. How can I do this? I have tried simple join on category and name, i.e.
var cats = categories.join(, );
OR
var cats = categories.name.join(, );
But since we are looking at it's members and their string values, it doesn't work.
More From » jquery