Reputation: 133
I guess I am looking for a best method of passing values: arrays, objects, JSON -- any data -- from PHP to javascript.
So far I've just seen:
PHP - json_encode(value);
Javascript - eval()
and a variation of that by using json2.js or the alike.
Upvotes: 0
Views: 214
Reputation: 16871
PHP has:
json_decode
--> decodejson_encode
--> encodeJavaScript (json2.js) has:
JSON.stringify
--> encodeJSON.parse
--> decodeUpvotes: 3