javascript - How to access a json array in php? -
i'm using html , javascript send json data php file. http://jsfiddle.net/expertsystem/9awnj/
how access there in php echo out given element?
something along lines of:
$value = json_decode($_post["neworder"]) echo $value[1]; etc
i'm not sure how retrieve data this.
here jsfiddle see how javascript should in case you're still lost: http://jsfiddle.net/9awnj/3/
this data decoded php:
`stdclass object ( [order] => array ( [0] => 2 [1] => 3 [2] => 4 [3] => 5 [4] => 6 [5] => 7 [6] => 8 [7] => 9 [8] => 10 [9] => 11 [10] => 1 [11] => 12 ) )` to access it be: example:
$order_0=$value->order[0]; $order_1=$value->order[1]; or use true json_decode , become this
$order_0=$value['order'][0]; $order_1=$value['order'][1];
Comments
Post a Comment