it was always a question for me that how can i use an array value in javascript while that array is defined in my php scripts
For example consider reading some values from a file and use it in javascript.
what's ur plan to do so ?
asked Feb 1, 2010 at 21:13
You can use the json_encode
function, to safely return a JSON object which you can use directly in JavaScript:
var jsArray = ;
Outputs:
var jsArray = ["foo","bar","baz"];
answered Feb 1, 2010 at 21:22
1
Something like this?