On Friday 10 February 2006 14:52, Robin Haswell wrote: > I think that's a bit overkill. My fix should work fine for anything that > doesn't include newlines. If this were my application I'd dump the data > in a hidden <ul><li> or maybe as an xml string and parse it with the > built-in DOM parser. Much better parse something in XML than *shudder* > javascript. JS shouldn't be used for heavy data processing because it > burdens the client (IMO).
errr.... no, I meant for him to take his php array, let's say it's this: $something = array ("bob", "larry", "frank"); then pass it to a JSON serializer, which will return a string, something like this: ['bob', 'larry', 'frank'] then drop that string in place where he currently has the broken javascript array. The advantage is, he doesn't have to think about the escaping of strings and such, because the JSON serializer does it for him. I use this technique a lot in my own code for building an array/hash in perl and then 'converting' it to javascript and dropping it inside a <script> tag. -Jeremy -Jeremy -- Jeremy Kitchen ++ [EMAIL PROTECTED] In the beginning was The Word and The Word was Content-type: text/plain -- The Word of Bob.
pgpZXgxq2vc3r.pgp
Description: PGP signature
_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs