Pass associative data from php to javascript

Associate
Joined
26 Nov 2004
Posts
1,480
Location
Gran Canaria
Hi

What is the best way to pass associative data from php to javascript? I read that associative arrays in js are 'dangerous' and there really isn't anything obvious I can find.

Thanks.
 
Worked great, thanks. I needed to use the contents of a php query from an xmlhttp request to populate a select box. I created a string with all of the select values and option names, then used eval to create an object.

I don't really like sending syntax specific data from php and would rather send a pure data structure, if that makes sense.
 
It would seem that most developers would agree with you, though that may be resistance to change. Performance wise there doesn't seem to be much in it.
 
Back
Top Bottom