[Seaside] jquery ajax responses?
Johan Brichau
johan at inceptive.be
Sun Feb 16 19:29:54 UTC 2014
Hi,
You can pass values between callbacks via temporary variables (or instance variables too).
There are multiple ways of getting this done in the onClick handler. For example:
renderContentOn: html
| translatedText |
html textArea
id: #tainput;
callback: [:intext | translatedText := self translate: intext].
html div
id: 'results';
with: 'Translated text will come here'.
html button
bePush;
onClick: (html jQuery ajax
serialize: (html jQuery id: #tainput');
onSuccess: ((html jQuery id: 'results') load:[:r | r render: translatedText]));
with: 'Translate'.
On 16 Feb 2014, at 19:50, tournesolo at gmail.com wrote:
> renderContentOn: html
>
> html textArea
> id: #tainput;
> callback: [:intext | self translate: intext].
>
> html div
> id: 'results';
> with: 'Translated text will come here'.
>
> html button type: 'button';
> onClick: (html jQuery ajax
> onSuccess: (
> "--> here is where I need to grab the result of the callback above (the translated text),
> instead of showing the raw submitted value as below <--"
> (html jQuery: #'results') text: (html jQuery: #tainput) value);
> serialize: (html jQuery: '#tainput'));
> with: 'Translate'.
>
>
> Thanks for any pointer!
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
More information about the seaside
mailing list