How To Pass A Php Array Of String Values To A Javascript Variable
I need to use php arrays in my javascript code. The arrays are defined in PHP in the same file as the javascript. I have tried the following two ways: var array_name = new Array('&
Solution 1:
put that json string into quotes (single quotes!)
var array_name = '<?php echo json_encode($php_array);?>';
enjooy
Post a Comment for "How To Pass A Php Array Of String Values To A Javascript Variable"