Re: [nyphp-talk] PHP to ajax variable passing problem

2007-08-10 Thread csnyder
On 8/9/07, Dell Sala <[EMAIL PROTECTED]> wrote: > > 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 > That s

Re: [nyphp-talk] PHP to ajax variable passing problem

2007-08-09 Thread Edward Potter
I have been hooked on jQuery. AMAZING JS stuff. There is an ajax/form plug in that will handle all this. Serialize, JSON, zillion options. Mixing it all up with php, and you can do pretty much anything. http://jquery.com/ Plug in examples: http://www.malsup.com/jquery/form/#code-samples :-)

Re: [nyphp-talk] PHP to ajax variable passing problem

2007-08-09 Thread Dell Sala
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

Re: [nyphp-talk] PHP to ajax variable passing problem

2007-08-09 Thread csnyder
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+')'); > > Better answer — don'tr try to reinvent the wheel. Yeah but we can't he

Re: [nyphp-talk] PHP to ajax variable passing problem

2007-08-09 Thread Cliff Hirsch
On 8/9/07, Cliff Hirsch <[EMAIL PROTECTED]> wrote: >> My Ajax response handler uses this line, which is fairly typical: >> var output = req.responseText; >>> >From php, I'm echoing back json. Example: {"status":1,"count":0,"data":""} >> But instead of var output being an object, it is a string: >>

Re: [nyphp-talk] PHP to ajax variable passing problem

2007-08-09 Thread Tom Sartain
I'm not great with Javascript and I know next to nothing about Json, but I know responseText will return a string, and PHP will output a string, so you need to use javascript to use javascript to take the string and un-serialize it (I don't know if this is technically un-serializing or not, but...

[nyphp-talk] PHP to ajax variable passing problem

2007-08-09 Thread Cliff Hirsch
My Ajax response handler uses this line, which is fairly typical: var output = req.responseText; >From php, I¹m echoing back json. Example: {"status":1,"count":0,"data":""} But instead of var output being an object, it is a string: ³{"status":1,"count":0,"data":""}² How do I make this an object