# How to access current javascript object by $(this) using remote\_function :complete

**URL:** <https://www.ruby-forum.com/t/how-to-access-current-javascript-object-by-this-using-remote-function-complete/143592>\
**Category:** Rails\
**Created:** [July 21, 2008, 12:18am UTC](https://www.ruby-forum.com/t/how-to-access-current-javascript-object-by-this-using-remote-function-complete/143592 "2008-07-21T00:18:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![flaubert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/858c86/32.png) [@flaubert](https://www.ruby-forum.com/u/flaubert)\
**Post date:** [July 21, 2008, 12:18am UTC](https://www.ruby-forum.com/t/how-to-access-current-javascript-object-by-this-using-remote-function-complete/143592/1 "2008-07-21T00:18:15Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![flaubert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/858c86/32.png) [@flaubert](https://www.ruby-forum.com/u/flaubert)\
**Post date:** [July 21, 2008, 8:58am UTC](https://www.ruby-forum.com/t/how-to-access-current-javascript-object-by-this-using-remote-function-complete/143592/2 "2008-07-21T08:58:17Z")

</div>

On Jul 20, 11:17 pm, flaubert [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> but, in remote\_function :complete it not works!!!  
> Because at the point that the complete function runs, ‘this’ is  
> different.

Fred
