# Link\_to with parameters

**URL:** <https://www.ruby-forum.com/t/link-to-with-parameters/92024>\
**Category:** Rails\
**Created:** [April 14, 2007, 8:35pm UTC](https://www.ruby-forum.com/t/link-to-with-parameters/92024 "2007-04-14T20:35:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [April 14, 2007, 8:35pm UTC](https://www.ruby-forum.com/t/link-to-with-parameters/92024/1 "2007-04-14T20:35:29Z")

</div>

using link\_to\_remote I can do the following :

\<%= link\_to\_remote “Localisation GoogleMap”, :url =\> {:controller =\>  
‘profils’, :action =\> ‘locate\_me’, :id =\> current\_user}, :with =\>  
“‘lat=’+encodeURIComponent($F(‘latitude’))+’&lng=’+encodeURIComponent($F(‘longitude’))”,  
:method =\> :get %\>

where latitude and longitude are hidden fields in my form.

but I must use a link\_to (to display the map), and I don’t know how to  
rewrite that

\<%= link\_to “Localisation GoogleMap”, :controller =\> ‘profils’, :action  
=\> ‘locate\_me’, :id =\> current\_user, :lat =\> ???, , :lng =\> ???

thanks for your help

kad

---

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [April 14, 2007, 10:17pm UTC](https://www.ruby-forum.com/t/link-to-with-parameters/92024/2 "2007-04-14T22:17:54Z")

</div>

On Apr 14, 2007, at 8:35 PM, Kad K. wrote:

> \<%= link\_to “Localisation GoogleMap”, :controller =\>  
> ‘profils’, :action  
> =\> ‘locate\_me’, :id =\> current\_user, :lat =\> ???, , :lng =\> ???

This a possible approach:

\<%= link\_to(  
name,  
options,  
:onclick =\> “this.href += ‘?lat=’ + encodeURIComponent($F  
(‘latitude’))”  
)  
%\>

– fxn
