[Seaside] Noob jQuery AJAX question

Tony Fleig tony.fleig at gmail.com
Sun Nov 14 17:23:56 UTC 2010


Hi.

I want to, using AJAX, when the user selects a value from a list, pass that
value to the server for processing and in response change the value of an
item on the screen based on some server-side processing.

I expected to be able to do this in a single transaction with the server,
but I have been unable to find a way to do so.

anAjax>>#serializeThis allows me to pass the selected value to the server,
and anAjax>>#script: allows me to change the screen component value. I can't
figure out how to combine this into a single server request. I don't seem to
have access to an Ajax canvas object in the callback when I use
serializeThis.

I hope I'm missing something simple.

Here is the toy test case I have been using:

enderContentOn: html

| val |

html div id: 'txt'; with: ''.
html break.
html select
list: { 1. 2. 3. };
selected: 2;
 "Pass the selection back to the server and save it."
onChange: (html jQuery ajax serializeThis);
callback: [ :v |  val := v ];
 "Set the div text to one less than the saved value"
onChange: (html jQuery ajax script: [ :s | s << (s jQuery: '#txt') text:
(val - 1) ])
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20101114/f937398e/attachment.htm


More information about the seaside mailing list