On Jan 30, 2006, at 12:22 PM, james wrote:
Can someone give me an example of how to pass additional arguments to
your callback function? I've read the documentation and I *think* I
understand what it says, but I'm unsure of the correct syntax.
What I'm specifialy trying to do is pass the field element to the
callback function like so:
function validateField(el) {
var url = "validate.asp?field="+el.value;
var d = doSimpleXMLHttpRequest(url).addCallback(noError(el,r));
}
function noError(el,r) {
.... process response r
.... and then do something with element el
}
This is wrong because you are *calling* noError in that addCallback
statement.. with a result that you don't even have yet!
The syntax you're looking for is: addCallback(noError, el)
Everything else looks fine.
-bob