javascript - Accessing multidimensional array in JS created by PHP's json_encode -
here php code:
$map[1][3]['test'][0]='weee'; $map[4][5]['test'][0]='bleh'; $map[1][3]['bleh'][0]='mooo'; $map[1][3]['bleh'][1]='baaa'; echo "map = " . json_encode($map) . ";"; how access these items in javascipt?
i've tried sorts:
map[1][3]['bleh'][1] map[1][3].bleh[1] map.1.3.bleh[1] but nothing seems work :(
thanks!
works me, except last one
<html> <body> <script type="text/javascript"> <?php $map[1][3]['test'][0]='weee'; $map[4][5]['test'][0]='bleh'; $map[1][3]['bleh'][0]='mooo'; $map[1][3]['bleh'][1]='baaa'; print "map = ".json_encode($map).";\n"; ?> alert(map[1][3]['bleh'][1]); alert(map[1][3].bleh[1]); </script> </body> </html>
Comments
Post a Comment