flaubert
2008-Jul-20 22:17 UTC
How to access current javascript object by $(this) using remote_function :complete
Hello I have the following: ........... :onchange => remote_function(:url => {:action => ''some_action''}, :with => "''id=''+this.value", :complete => "var x = eval(''('' + request.responseText + '')''); $(this).next(''.product_price'').value x;" ) %> If :onchange contains only $(this).next(''.product_price'').value "soma value" , it works!! but, in remote_function :complete it not works!!! why?? tnks all! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Jul-21 06:57 UTC
Re: How to access current javascript object by $(this) using remote_function :complete
On Jul 20, 11:17 pm, flaubert <aflaube...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello > I have the following: > ........... > :onchange => remote_function(:url => {:action => ''some_action''}, :with > => "''id=''+this.value", :complete => "var x = eval(''('' + > request.responseText + '')''); $(this).next(''.product_price'').value > x;" ) %> > > If :onchange contains only $(this).next(''.product_price'').value > "soma value" , it works!! > but, in remote_function :complete it not works!!!Because at the point that the complete function runs, ''this'' is different. Fred> why?? > > tnks all!--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---