Best way to pass a 2d array into javascript from php?

Posted by 133794m3r on Stack Overflow See other posts from Stack Overflow or by 133794m3r
Published on 2010-05-12T09:41:32Z Indexed on 2010/05/12 9:44 UTC
Read the original article Hit count: 221

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about php