that = this;

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
}
})
});


Leave a Reply

Formatting: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>