scramatte
2007-Apr-12 10:15 UTC
Using Ajax.Request, How can I access to parent context inside onSuccess callback ?
When I made an Ajax Request, how can I access to parent context inside onSuccess callback. I mean that in the example below I would like to get value of var "a" function test() { var a = ''test''; new Ajax.Request(''/myurl'', { method:''get'', onSuccess: function(transport) { alert(this.url); } } } Any ideas ? --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Mario Orlando
2007-Apr-12 14:00 UTC
Re: Using Ajax.Request, How can I access to parent context inside onSuccess callback ?
Hi scramatte, have you tried this? function test() { var a = ''test''; new Ajax.Request(''/myurl'', { method:''get'', onSuccess: function(transport) { alert(a); } } } this should work! bye, Orla On 12/04/07, scramatte <s.cramatte-39ZsbGIQGT5GWvitb5QawA@public.gmane.org> wrote:> > > When I made an Ajax Request, how can I access to parent context > inside onSuccess callback. > I mean that in the example below I would like to get value of var > "a" > > > function test() { > > var a = ''test''; > > new Ajax.Request(''/myurl'', > { method:''get'', > onSuccess: function(transport) { > alert(this.url); > } > } > > } > > > Any ideas ? > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---