I'm using the prototype Ajax.Request with an anonymous functions
inside of a javascript object. However, once I get into the anonymous
function of the Ajax.Request onSuccess, I loose the bindng to my
object and this now refers to window instead of my object.
How can I maintain binding from within the anonymous function?
Code snippet:
CampaignView.prototype.DataBind=function(event)
{
var c=this; //binding is still good - refers to CampaignView
object
new Ajax.Request('url.aspx',
{
method: 'post',
onSuccess: function(resp)
{
var d=this; //binding is lost - refers to window
}
});
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---