NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP to ajax variable passing problem

Tom Sartain tomsartain at gmail.com
Thu Aug 9 15:32:22 EDT 2007


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... make
an object out of a string)
So... yeah.. javascript issue for sure. Hope someone else can help you more
(and I'd like to know the answer too for my own education)

-Tom

On 8/9/07, Cliff Hirsch <cliff at pinestream.com> 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:
> "{"status":1,"count":0,"data":""}"
>
> How do I make this an object?
>
> Cliff
>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20070809/633d4b46/attachment.html>


More information about the talk mailing list