I took a php array with double arguments (that has like ['contact']['en'] or ['contact']['fr'] or ['presentation']['en']) and did a json_encode to have its values in javascript (so I can use it for ajax)
when I do alert(JSON.stringify(myvariable, null, 4)); I get something like :
{
"contact":{
"fr":"value",
"en":"value2",
"es":"value3"
},
"presentation":{
"fr":"value",
"en":"value2"
},
etc...
}
What I want to do is to check if a value is equal to the first object (ex: contact=contact) then do a loop for that gets all the values when the condition is met. So if contact = contact, then get me the value of fr,en and es in contact. I managed to do the first object with:
for (var k in variable){
if(k == valuechecked)
{
}
}
But when I do inside if(k == valuechecked):
for (var a in k){
alert(a);
}
It shows numbers from 0 up to I believe the amount of k there is (therefore the first object). I managed to do what I want with php but not with javascript ... How do I get the values of the objects inside the validated object?