[Seaside] Get the result of JS function

Thomas Heniart heniart.thomas at gmail.com
Tue Sep 22 17:47:41 UTC 2015


Error is in wqTest (:1:104), so I don't think that error is in my JS file
which only contains
function test() {
  return true;
}

Really strange...


2015-09-22 19:35 GMT+02:00 Johan Brichau <johan at inceptive.be>:

> In what file is the syntax error?
>
> This is probably a syntax error in your javascript.
>
> On 22 Sep 2015, at 19:21, Thomas Heniart <heniart.thomas at gmail.com> wrote:
>
> I get this error when I load the page:
> SyntaxError: expected expression, got '.'
> and I don't know why :/
> What could it be?
>
>
> Cheers,
> Thomas
>
> 2015-09-22 18:31 GMT+02:00 Thomas Heniart <heniart.thomas at gmail.com>:
>
>>
>>
>> 2015-09-22 9:13 GMT+02:00 Johan Brichau <johan at inceptive.be>:
>>
>>> Thomas,
>>>
>>> You can use the jQuery binding in Seaside to easily return javascript
>>> values in ajax callbacks.
>>> For example:
>>>
>>> html
>>>         button;
>>>         onClick: (html jQuery ajax callback: [:value | Transcript show:
>>> value ] value: (html javascript call: ‘test’ withArguments: #()))
>>>         with: ‘Call test’
>>>
>>
>> I tried this but it doesn't work, nothing appeared in the Transcript like
>> if the callback isn't triggered...
>> Maybe I forget something in the configuration of application
>> (WAAdmin register: self asApplicationAt: 'Test')
>>         addLibrary: JQDevelopmentLibrary;
>>         addLibraby: MyLibraryWithJsFiles
>>
>> MyLibraryWithJsFiles contains just a js file with test() { return true; }
>>
>>
>>>
>>> The #callback:value: method passes the result of client-side expression
>>> to the server-side callback.
>>> Mind that (as the method comment states), this only works for single
>>> literal Javascript object (String, Number, Boolean). If you want to pass
>>> more complex result values, you can use #callback:json: or write your own
>>> serialization if json serialization is not sufficient either.
>>>
>>> Hope this answers your question,
>>> Johan
>>>
>>
>>
>> Thanks for your help,
>>
>> Thomas
>>
>>
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20150922/ad6d680a/attachment.htm


More information about the seaside mailing list