NYCPHP Meetup

NYPHP.org

[nycphp-talk] AJAX and State

tedd tedd at sperling.com
Wed Sep 5 20:36:33 EDT 2007


At 7:47 PM -0400 9/5/07, Steve Manes wrote:
>tedd wrote:
>>Now, what I am asking is not how ajax communication with the server 
>>can be used, but rather is there anything beyond that which ajax 
>>can provide?
>>
>>Another way of asking this question is, "Besides not triggering a 
>>refresh, what can ajax do that php can not?"
>
>You're right: nothing.  But just focusing on the get/post mechanics 
>as a baseline for comparison is kinda reducing the question to, "is 
>there anything client/server can do that client/server can't do?"
>
>Ajax is just a tool.  My table saw cuts wood one way, my compound 
>miter saw another, my radial arm saw another.  Technically, they can 
>all do the same cuts.  It's just a lot nicer (and safer) to use a 
>table saw to rip panels and an SCMS to crosscut long lumber.  And 
>technically most of what they can do can be done with a manual 
>carpenter's saw and a bottle of glucosomine.
>
>Here's an example where Ajax is the better tool.  I'm building a 
>medical application which has a desktop containing seven collapsible 
>DIVs.  Each of those DIVs can also have at least two states: view 
>and edit.  Some have three, with a result list (like a list of 
>current insurance policies).  That's the way the client wanted it.
>
>Necessarily, there are a lot of queries going on to populate all the 
>DIVs on that page: patient demographic info, insurance info, 
>guarantor info, family relations info, a list of historical 
>referrals, appointments, patient transportation, etc.  So 
>repopulating that page sucks the air out of the database.  If I 
>correct a start date for an insurance policy do I really want to 
>repopulate that entire desktop page?  Heck no.
>
>The better solution is to submit just the form that matters and 
>update just those DIVs where that update has data relevance.  Mostly 
>it's two just queries instead of a dozen: put_foo and get_foo, with 
>Ajax arbitrating which display elements get updated.

Oh, I get the reasons for using it. No arguments from me.

The beginning of this thread led me to suspect that someone had found 
a way to move data from one browser window to another and I was 
focusing in on that, but that turned to be false.

Cheers,

tedd
-- 
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com



More information about the talk mailing list