I've got a simple request
var v = "Some var";
var testReq = new Request.JSON({
url:"/test/",
onRequest:function(v){alert (this+'\n'+v)}.pass(v)
}).send();
And it shows me:
[object Window]
Some var
But, if I remove pass() I got
[object Object]
undefined
And the Object here is my request object (instead of Window object
with pass())
Am I write that it's a strange behavior? Or maybe someone could
explain me why it should be Window instead of Request associated with
*this*?
I've found only one solution: I've added onRequest like this:
testReq.setOptions({onRequest : on_request.bind(testReq, v)})
just before sending it.