[Seaside] Seaside and Ajax

Steven Swerling sswerling at yahoo.com
Sat Aug 20 18:49:36 CEST 2005

Chris Double wrote:
> ...See here for example:
> http://www.cincomsmalltalk.com/userblogs/avi/blogView?showComments=true&entry=3268075684

Just took a look at Avi's "liveUpdater.js" script he referred to in the 
blog entry linked above.

I'm a bit new to javascript, and wondered about a couple of things in 
this script (maybe this question belongs on some javascript newsgroup).

The code below shows an abridged version of liveUpdater.js.

The first thing that jumped out was embedding one function inside of 
another. Does it buy you anything beyond encapsulation?

Second -- that "request.open("GET", uriFunc());". How the heck does that 
work? "function (){blah}" is passed in as "uriFunc". Does putting the 
"()" after the function name as in "uriFunc()" cause the function to be 
executed? (BTW, other examples on the web show this "request.open()" 
function taking a string for the URI).

I sort of struck out online trying to answer these questions. Anyone got 
any good links or book refs for javascript?

Finally, is anyone using this script? The notion of replacing any 
element w/ an id from the server is pretty appealing.

=== The abridged code ===

function liveUpdaterUri(uri)
     return liveUpdater(function() { return uri; });

function liveUpdater(uriFunc)
     function update()
      request.open("GET", uriFunc());
   return update;

More information about the Seaside mailing list