You could try some binding and passing to this, but I find using an extra
function definition to be more readable.
var that = this;
new Request({
url:opts.uri,
onSuccess: function(responseText, responseXML) {
that.myfunc(responseText, {'bob':'sally'});
}
}).send();
On Tue, Nov 30, 2010 at 2:55 PM, doubleTap <[email protected]> wrote:
> I have a function in a class like
>
> myfunc:function() { some fun statements; }
>
> Then I use it as a call back in an ajax call like
>
> new Request({url:opts.uri, onSuccess:this.myfunc.bind.(this,
> {'bob':'sally'}) }).send();
>
> Now in my case I am running it all works fine except for the argument
> I am passing in the bind. My essential question is: How do I bind
> arguments to a function in a way that allows for additional arguments
> to be passed to it when called?
>
> In this case the call would be receiving the server response on
> success of the ajax request. I know I have done it before but I think
> I lost that part of my brain to mardi gras last year.