My json data is this:
{
"guide":0,
"reunits":[
{
"residence":[
{
"name_re":"THE PORT",
"id":"88aa355ca54853640929c25c33613528"
}
]
},
{
"residence":[
{
"name_re":"KECIK",
"id":"2843543fa45857d92df3de222938e84a"
}
]
},
{
"residence":[
{
"name_re":"GREEN ANKA",
"id":"fe585cc4b4dfff1325373728929e8af9"
}
]
}
]
}
How can done alert, value name_re or id in json data above by each in jquery?
My try:
$.each(data.reunits, function (index, value) {
alert(value.residence.name_re); // this don't output.
})
alert(value.residence[0].name_re);looks like arrayTHE PORT) no all three.for...inloop$.eachfor it to iterate through, I just fixed the statement with the bugfor...inloop.