# JQuery GET without link\_to\_remote. How?

**URL:** <https://www.ruby-forum.com/t/jquery-get-without-link-to-remote-how/177595>\
**Category:** Rails\
**Created:** [October 20, 2009, 6:05pm UTC](https://www.ruby-forum.com/t/jquery-get-without-link-to-remote-how/177595 "2009-10-20T18:05:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![spitfire](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a5b964/32.png) [@spitfire](https://www.ruby-forum.com/u/spitfire)\
**Post date:** [October 20, 2009, 6:05pm UTC](https://www.ruby-forum.com/t/jquery-get-without-link-to-remote-how/177595/1 "2009-10-20T18:05:27Z")

</div>

Hi,  
I start to use JQuery with Rails:  
I should make a simple text link to call in Ajax (by GET) an action in  
controller.

link\_to\_remote is a Prototype method, I would use just a javascript  
framework (JQuery).

Is it possible to use “link\_to” to make ajax call ?  
(I didn’t have succeed )  
What I should use instead of link\_to\_remote ?

Thank you !  
Alessandro

---

<div class="post-metadata">

**Author:** ![spitfire](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a5b964/32.png) [@spitfire](https://www.ruby-forum.com/u/spitfire)\
**Post date:** [October 20, 2009, 6:25pm UTC](https://www.ruby-forum.com/t/jquery-get-without-link-to-remote-how/177595/2 "2009-10-20T18:25:18Z")

</div>

On Tue, Oct 20, 2009 at 6:05 PM, Ale Ds  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi,  
> I start to use JQuery with Rails:  
> I should make a simple text link to call in Ajax (by GET) an action in  
> controller.
> 
> link\_to\_remote is a Prototype method, I would use just a javascript  
> framework (JQuery).  
> OK, Prototype is a Javascript framework and happens to be the default  
> for Rails, but link\_to\_remote is a Rails method.  
> If you’re gonna use jQuery on your Rails application, you better  
> install the jrails plugin[1] which will give you the proper  
> replacements for those helper methods.

> Is it possible to use “link\_to” to make ajax call ?  
> Yes, it is.

> (I didn’t have succeed )  
> What I should use instead of link\_to\_remote ?  
> You could use any click handler function and perform an $.ajax or  
> $.get or $.post call in that handler, jQuery docs has the right  
> information for you.

[1][http://wiki.github.com/aaronchi/jrails](http://wiki.github.com/aaronchi/jrails)

–  
Leonardo M…  
There’s no place like ~

---

<div class="post-metadata">

**Author:** ![spitfire](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a5b964/32.png) [@spitfire](https://www.ruby-forum.com/u/spitfire)\
**Post date:** [October 20, 2009, 9:56pm UTC](https://www.ruby-forum.com/t/jquery-get-without-link-to-remote-how/177595/3 "2009-10-20T21:56:04Z")

</div>

There are a number of great railscasts that cover this topic.

> **[Ruby on Rails Screencasts - RailsCasts](http://railscasts.com/episodes?search=jquery)**
>
> Short Ruby on Rails screencasts containing tips, tricks and tutorials. Great for both novice and experienced web developers.

It is possible to use the jrails plugin. It is also possible to code  
your application using unobtrusive javascript, which may be another  
good topic to study. That way you remove a lot of the clutter from  
your views.

sax

---

<div class="post-metadata">

**Author:** ![spitfire](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a5b964/32.png) [@spitfire](https://www.ruby-forum.com/u/spitfire)\
**Post date:** [October 22, 2009, 11:40am UTC](https://www.ruby-forum.com/t/jquery-get-without-link-to-remote-how/177595/4 "2009-10-22T11:40:54Z")

</div>

Leonardo M. wrote:

> On Tue, Oct 20, 2009 at 6:05 PM, Ale Ds  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Hi,  
> > I start to use JQuery with Rails:  
> > I should make a simple text link to call in Ajax (by GET) an action in  
> > controller.
> > 
> > link\_to\_remote is a Prototype method, I would use just a javascript  
> > framework (JQuery).  
> > OK, Prototype is a Javascript framework and happens to be the default  
> > for Rails, but link\_to\_remote is a Rails method.  
> > If you’re gonna use jQuery on your Rails application, you better  
> > install the jrails plugin[1] which will give you the proper  
> > replacements for those helper methods.
> 
> > Is it possible to use “link\_to” to make ajax call ?  
> > Yes, it is.  
> > yes, you are right.  
> > I have resolved in this way:  
> > in the view  
> > \<%= link\_to(‘Update table’, users\_path(@user) ,:id =\> ‘id\_update\_link’)  
> > %\>  
> > and in application.js  
> > $(‘#id\_update\_link’).click(function(){  
> > $.get($(this).attr(“href”), $(this).serialize(), null,  
> > “script”);  
> > return false;  
> > });

thank you,  
Alessandro
