that = this;
January 10th, 2008 • Uncategorized
var Foo = Behavior.create({
var that = this; // work around bug with this in inner functions
this.foo = "bar";
new Ajax.Request(url, {
//...
onSuccess: function(transport) {
alert(that.foo); // this.foo would not work
}
})
});