NYCPHP Meetup

NYPHP.org

[nycphp-talk] So who's using Ajax anway?

Dell Sala dell at sala.ca
Thu Nov 9 15:12:44 EST 2006


For returning HTML blocks I just use plain text. But if I don't want  
my server-side handlers to have to know too much about the html  
context in which they will be used I send back raw data in JSON. JSON  
rocks. You just need a library on the server-side to translate your  
PHP data structures into JSON.

ex:

array('name' => 'joe', age => '35');

is transformed into a simple javascript object that is easy to work  
with.

{ name : 'joe', age : '35' }

who needs the headache of XML for this?

-- Dell


On Nov 9, 2006, at 2:56 PM, David Mintz wrote:

> For you guys, does the X in AJAX really stand for XML? Or are you  
> sending
> back finished HTML?
>
> When it's finished HTML, dropping it into your page is utter cake,  
> but the
> front/back presentation/biz logic separation is less clean. When it's
> XML, you find yourself doing all that DOM stuff and it gets  
> tedious. Why
> go to the trouble of generating XML if you never intend to do  
> anything but
> turn it into HTML anyway?
>
> Unless I'm missing something...
>
> ---
> David Mintz
> http://davidmintz.org/




More information about the talk mailing list