On Aug 9, 2007, at 3:46 PM, csnyder wrote:

On 8/9/07, Cliff Hirsch <[EMAIL PROTECTED]> wrote:

As usual, figured it out minutes after my post. Answer for the group:

 From: var output = req.responseText;
 To:     var output = eval('('+req.responseText+')');


Yes eval(), which always makes me a little queasy, even though I know
it's relatively safe. I wonder how many years we'll be waiting for a
true json_decode() function to make it into general circulation?

json.org provides a json decoder for javascript. I've always used this instead of eval. This will only parse the json subset, and will fail for other arbitrary javascript.

http://www.json.org/js.html
http://www.json.org/json.js

-- Dell


_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to