Hey,
eggie5 a écrit :
> onSuccess: function(resp)
> {
> var d=this; //binding is lost - refers to window
> }
Which is exactly why all Prototype docs tell you to bind any function
you're not calling directly over its "this" object, *or* save the
reference externally and use it later.
Solution A:
new Ajax.Request('url.aspx', {
onSuccess: function(resp) {
this....
}.bind(theObjectYouWantAsThisInThere)
});
Solution B:
var view = this;
new Ajax.Request('url.aspx', {
onSuccess: function(resp) {
view.... // instead of "this...."
}
});
--
Christophe Porteneuve aka TDD
[EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---