[Seaside] Re: Javascript calls through jQuery

Esteban A. Maringolo emaringolo at gmail.com
Sun Mar 2 23:32:30 UTC 2014

2014-03-02 15:55 GMT-03:00 Karsten Kusche <karsten at heeg.de>:
> Esteban,
> I want to move as much as I can from the JS file to Seaside, because
> now I need to add certain parameters to the request, and I thought it
> would be simpler to do it with Seaside.
> in recent projects i've found it's much easier to do it exactly the other
> way around. Keep as much code in a js file and configure it via Seaside.
> Doing jQuery inline in Seaside just makes things more complicated as you
> need to write the jQuery code in the Seaside style and not plain normal
> Javascript. It also has the benefits of being easier to debug as you can
> just set breakpoints at a line. The Seaside-generated Javascript code is
> typically pretty tight and not pretty-printed, making it extremely hard to
> debug.

I share the same approach with you, Today I'm doing exactly that.
Creating JS source from Smalltalk can be really convoluted. All the
Seaside jQuery implementation is really clever in terms of code
generation. But for custon JS you can't do that.

So now I only I want to call my own JS function at the end of the JSON callback.
The thing is that in this case I want to use the same Seaside session
for the ajax call, given the fact that URL routing with Seaside is not
as straightforward as you might like, having stateful components is
the counterpart of the URL management, and I could take advantage of
having everything at the server side to generate the JSON response
based on component state instead of request parameters.

> The only places where i use Seaside-jQuery code is when i need to generate
> render-callbacks or other kinds of callbacks. But as Javascript objects can
> be assigned to any kind of DOM Object you can separate the callback-code
> from the other javascript code quite nicely.

So far I'm using it only for this, but I want to move forward a few extra steps.


Esteban A. Maringolo

More information about the seaside mailing list