hi all,
I’m trying to send a php array after json_encode($array) to client side via ajax, in the client side, i do a eval(xmlhttprequest.respondeText) but I get this error – “invalid label”
[B]server side(php)
$encoded_value = json_encode($package_array);
// $package_array of this format
//$package_array[‘1,1,2,15’] = ‘1’
echo($encoded_value); //echoing to ajax
[B]client side(javascript)
val = ajax_object.responseText;
alert(“val is”+val);
decoded_val = eval(val);
alert(decoded_val);
#ERROR I get is “invalid label {“1,1,C,15″:”1”}
[B]client side(javascript)-try 2
val = ajax_object.responseText;
alert(“val is”+val);
decoded_val = eval(‘(‘ + val + ‘)’);;
alert(decoded_val);
#with the above eval of responseText I get an object, I don’t know how to read values from this object.
I hope I’m clear with the description of the problem. any help is appreciated.
thanks,
karthik