what about : onComplete: this.foo2.bind(this)
On Wed, Apr 1, 2009 at 9:06 AM, cpt.oneeye <[email protected]>wrote: > > Is it possible to handle the Ajax Response directly by the method of > an object. > > A simple example: > > var myClass = new Class({ > > initialize: function(param) { > this.x = param; > }, > > foo1 : function(){ > var jSonRequest = new Request.JSON({ url: "../myurl.apx", > onComplete: this.foo2}).send(); > } > > foo2 : function(response){ > alert(this.x + ":" + response); // here this.x is always > undefined > } > }); > > var c1 = new myClass("hello"); > c1.foo1(); > > > > The foo1-Method of myClass makes an AjaxRequest. The Response should > then be handled by the foo2-method. This works so far. But the problem > is that this is not the foo2-Method of the instance c1. > > I have mulitple instances of myClass and i want that every instance > handles its own requests and responses. For now i have to pass > parameters to the url and return them back in the response so that i > know to which instance this response belongs to. > > Any idea? > > Thx and greetings > Klaus -- fax : (+33) 08 26 51 94 51
