I understand we can use following to process a simple ajax JSON response
function onSuccess(response) {
console.log("Service call successful with response"+response);
$.each(response, function (key, value) {
console.log(key+" "+value);
}) ;
But, how to process to an array of JSON response like below?
{
"xyzs":[
{
"xyz":{
"id":"515f08380364db3bbe5a27f1",
"xyz_id":"320224817603309569"
}
},
{
"xyz":{
"id":"5161f9880364db3bbea86595",
"xyz_id":"321033680736886784"
}
}
]
}
onSuccess() function doesn't give expected output id
and xyz_id
in console with above response.
Is there some for
loop in javascript which I use in onSuccess()
function to get values of id and xyz_id?