I have php array like this
[0]->imgae_name=1
image_url=a
[1]->imgae_name=2
image_url=b
i want to convert this array in javascript array how can i do this?
I have php array like this
i want to convert this array in javascript array how can i do this? |
|||
|
You could convert the PHP array to JSON using |
|||||||||||||
|
is the right way to do this. It converts your php array to this string:
Then you only have to assign it to a variable in a script tag. |
|||
|
In php
In Javascript
Then you can access the value :
|
|||
|