Best way to pass a 2d array into javascript from php?
- by 133794m3r
Ok, what i'm trying to do here is to pass a 2d array from php to javascript in the easiest way possible. The main reason for this is because i have the array which is previously filled with data via the phpscript and doing it one by one and just "calling it as it's needed" will not work out too well since well there's more than just one row required when it's called and i'd rather not do something like for all of the elements in it as it's number is unknown until it gets said data from the database. I was going to do a while loop to write in some of the data into elements sot hat it coudl be later pulled up more easily but i cannot seem to find an easy way to do this currently.
If anyone has an easy way to transfer this to javascript without having to do what i previously said.