I want to loop through
- each object within
listsand then - each
listwithinlistsand count the number of objects withinlist - if the number of objects within
list= 3, I want to alert the value of each object
JSON
{
"lists":[
{
"list":[
{
"value": "List 1 Value A"
},
{
"value": "List 1 Value B"
},
{
"value": "List 1 Value C"
}
]
},
{
"list":[
{
"value": "List 2 Value A"
},
{
"value": "List 2 Value B"
},
{
"value": "List 2 Value C"
},
{
"value": "List 2 Value D"
}
]
}
]
}
JQuery Code
$.each(response.lists.list, function(index, list){
alert(list.value);
}
Try using:
Here’s a fiddle.