I have one json object constructed as follows:
<?
$t['w'][$id]['marchin']=$machin;
$t['w'][$id]['c'][$id_com]['machin']=$machin;
echo json_encode($t);
?>
I browse the object like this
// here i access to all the $t['w'][$id]
$.each(data.w, function(k,v){
var that=this;
doSomething();
// now i want to access to all the $t['w'][$id]['c']
$.each(that.c, function(k1,v1){
doSomething();
});
});
but here at the second each jquery make an error .. How to access all $ t ['w'] [$ id] ['c']?!
thank you
Ok i tried :
$.each(data.w, function(k,v){
var that = $.parseJSON(this);
doSomething();
$.each(that[k]['c'], function(k1,v1){
doSomething();
});
});
but it does not work again,
here's an example of my json,
{"w":
{"3":
{"test":"test","c":
{"15":
{"test2":"test2"}
}
}
}
}
var myObj = $.parseJSON(data);