[Seaside] Seaside and Ajax

Yar Hwee Boon hboon at motionobj.com
Sat Aug 20 20:04:36 CEST 2005

On 21-Aug-05, at AM 12:49, Steven Swerling wrote:

> 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).

If you read it like Lisp, then it's probably going to be more 
understandable :) You are right, uriFunc() causes the function to be 
executed. Avi summed it up in his post:

"It provides the function liveUpdater(), which takes as its only 
parameter a URI-generating function uriFunc. liveUpdater() returns a 
new function, suitable for attaching, for example, to the onclick 
handler of a link. This handler function does this:

	• 	Generate a new URI with the provided uriFunc
	• 	 Make an HTTP GET request to that URI
	• 	 Extract from the response the first element that has an id 
	• 	 Replace the contents of the element with the corresponding id in 
the current document, with the contents of the element extracted from 
the new response"

> Finally, is anyone using this script?

If you mean from Seaside, you do not have to use this script 
explicitly. It is used behind the scenes in methods such as 
#textInputWithCallback: callbackBlock liveCallback: liveBlock.

(65) 6764-9774

More information about the Seaside mailing list