[Seaside] How to combine serialize and a load.

Timothy James Ziebart timothy at churchmilitant.org
Sat Jan 30 20:12:10 UTC 2010

Thank you Lukas.  When you see it done correctly it  becomes obvious.

On 30/01/10 02:44 AM, Lukas Renggli wrote:
>>     html select
>>             id: html nextId;
>>             list: (self session findCodeByParent: 'region' type: 'region');
>>             selected: model region;
>>             callback: [ :value | self regionSelectionChanged: value ];
>>             onChange: (html jQuery ajax  serializeThis);
>>                 onAjaxComplete: ((html jQuery id: 's_results' ) load html: [:
>> r | self renderResultsOn: r]).
> 1) #onAjaxComplete: is implemented on the jQuery object, not on the
> WASelectTag and not on the JQAjax instance. #onAjaxComplete: is used
> to register a global completion handler, there is also #onComplete: on
> the JQAjax itself that is used to register for that particular
> instance only.
> 2) You create two AJAX requests that are triggered one after each
> other. While this generally works it is very inefficient because it
> does two roundtrips to the server. If possible you should always
> combine AJAX calls. In most cases this is possible.
> Try something along:
>     .. onChange: ((html jQuery id: 's_results') load
>          serializeThis;
>          html: [ :r | self renderResultsOn: r ])
> That serializes AND renders the results in one AJAX call. You also
> don't need the #onAjaxComplete: because this is just one AJAX call.
> Lukas

More information about the seaside mailing list