[Seaside] jquery ajax responses?

Johan Brichau johan at inceptive.be
Mon Feb 17 19:32:17 UTC 2014


Ha yes, that's what I get when programming Smalltalk in an email client ;-)

glad you figured it out

Johan

On 17 Feb 2014, at 00:16, tournesolo at gmail.com wrote:

> 
> Thanks Johan! That was the simple trick I was looking for.
> 
> (for the record, my Seaside 3.0.6 in Squeak 4.3 had no #load: in
> JQueryInstance, so substituting the relevant line below did it)
> 
>       onSuccess: ((html jQuery id: 'results') load html: [:r | r render: translatedText]));
> 
> 
>> 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
>> 
>> _______________________________________________
>> seaside mailing list
>> seaside at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



More information about the seaside mailing list