[Seaside] jQuery - ajax setting temporary or ivars

Lukas Renggli renggli at gmail.com
Sun Jun 21 09:29:51 UTC 2009


> I guess I'm confused about the way Ajax works. Isn't it typically for
> loading/uploading files from/to the server?

Ajax works always works like this: It is a Javascript that does a
request on the server. What the server does with the request and what
the Javascript does with the response is up to you.

For example the following code

    html div
        onClick: (html ajax callback: [ count := count + 1 ]);
        with: 'Click Me'

increments 'count' whenever somebody clicks on the element, otherwise
nothing happens.

To also update the element you have to render some HTML, like this:

    html div
        onClick: (html this load html: [ :r | r render: (count := count + 1) ])
        with: 'Click Me'

Cheers,
Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch


More information about the seaside mailing list