# Link\_to

**URL:** <https://www.ruby-forum.com/t/link-to/194309>\
**Category:** Rails\
**Created:** [September 2, 2010, 9:40am UTC](https://www.ruby-forum.com/t/link-to/194309 "2010-09-02T09:40:26Z")\
**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:** [September 2, 2010, 9:40am UTC](https://www.ruby-forum.com/t/link-to/194309/1 "2010-09-02T09:40:26Z")

</div>

I am trying to use an encrypted request to PayPal using my own submit  
button link  
I googled a little but, but could not find a clear & neat solution, so  
I ended writing this :

# == Rails 2.3.8 script code ==== … \<% form\_tag APP\_CONFIG[:paypal\_url], {:id =\> ‘form\_paypal’} do %\> \<%= hidden\_field\_tag :cmd, “\_s-xclick” %\> \<%= hidden\_field\_tag :encrypted, @cart.paypal\_encrypted(root\_url, payment\_notifications\_url(:secret =\> APP\_CONFIG[:paypal\_secret])) %\>

\<%= link\_to\_function “OK”, “$(‘form\_paypal’).submit()” , :class  
=\> ‘buy’ %\>

  
\<% end %\>  
…

The display is fine (I get my button…), the generated code seems ok,  
but when I hit the button, nothing happen…

=== generated source code ====  
…

OK

where am I wrong ?

---

<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:** [September 2, 2010, 9:56am UTC](https://www.ruby-forum.com/t/link-to/194309/2 "2010-09-02T09:56:15Z")

</div>

[SOLVED] I realized that I was using jQuery and not Prototype  
anymore …  
so the link\_to function was not right and should have been written  
with the correct jQuery id # : (’#form\_paypal’).submit()

\<%= link\_to\_function “OK”, “$(’#form\_paypal’).submit()” , :class =\>  
‘buy’ %\>
