[nycphp-talk] AJAX and State
Kenneth Downs
ken at secdat.com
Wed Sep 5 10:22:33 EDT 2007
Hans Zaunere wrote:
>
>> Ajax solves this problem neatly by letting you move all state [1] into
>> the browser. This makes sense from an architectural viewpoint because
>> we are putting this context information close to where it is needed,
>> the UI.
>>
>
> I'm not sure what you mean, though, by keeping state in the browser.
>
For example, when a table maintenance form loads up (aka CRUD form),
with simulated tabs, one for browse, one for detail editing. There is a
global object that looks something like this:
x4global.tabs=new Object();
x4global.tabs[x0] = new Object();
x4global.tabs[x0].tabType = 'browse';
x4global.tabs[x0].table_id = 'contacts';
x4global.tabs[x0].columns = 'ssn,first_name,last_name,phone'
x4global.tabs[x0].widgets = new Object();
x4global.tabs[x0].widgets[ssn] = 'x4w_ssn'
x4global.tabs[x0].widgets[ssn] = 'x4w_ssn'
x4global.tabs[x0].widgets[ssn] = 'x4w_ssn'
...
... and so on
This allows the browser to keep a small library of JS code that receives
JSON back from the browser, then it looks at the response to see what it
should do, and uses the x4global object to figure out where to put things.
--
Kenneth Downs
Secure Data Software, Inc.
www.secdat.com www.andromeda-project.org
631-689-7200 Fax: 631-689-0527
cell: 631-379-0010
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20070905/be368a1e/attachment.html>
More information about the talk
mailing list