# jQuery and Rails

**URL:** <https://www.ruby-forum.com/t/jquery-and-rails/103727>\
**Category:** Rails\
**Created:** [May 9, 2007, 6:28pm UTC](https://www.ruby-forum.com/t/jquery-and-rails/103727 "2007-05-09T18:28:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnlester](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@johnlester](https://www.ruby-forum.com/u/johnlester)\
**Post date:** [May 9, 2007, 6:28pm UTC](https://www.ruby-forum.com/t/jquery-and-rails/103727/1 "2007-05-09T18:28:57Z")

</div>

Any jQuery users have an example or info regarding their jQuery  
integration  
to rails apps?

I’ve found plenty of tutorials and guides on setting up jQuery and doing  
some simple UI tasks. But I’d really like to compare my strategies of  
using jQ’s ajax (etc.) in Ruby on Rails applications with other users.

Anyone have any examples?

John

---

<div class="post-metadata">

**Author:** ![johnlester](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@johnlester](https://www.ruby-forum.com/u/johnlester)\
**Post date:** [May 9, 2007, 7:57pm UTC](https://www.ruby-forum.com/t/jquery-and-rails/103727/2 "2007-05-09T19:57:08Z")

</div>

I am a member of the jQuery team, and I am currently finishing up work  
on the first release of jQuery on Rails, a plugin for Rails that  
replaces the built-in prototype stuff with jQuery.

It’s not a 1:1 API rewrite, but rather an attempt to get the jQuery  
philosophy of unobtrusive coding into Rails. I will have a release  
ready for RailsConf (and I will be there as well).

– Yehuda K.

---

<div class="post-metadata">

**Author:** ![johnlester](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@johnlester](https://www.ruby-forum.com/u/johnlester)\
**Post date:** [May 18, 2007, 2:27am UTC](https://www.ruby-forum.com/t/jquery-and-rails/103727/3 "2007-05-18T02:27:57Z")

</div>

I just posted about what I’ve figured out so far regarding JQuery Ajax

- Rails here: [Crap](http://mad.ly/2007/05/17/jquery-ajax-rails/)

I discuss how to build JQuery Ajax calls that can interact with a  
RESTful controller method with a respond\_to block (you need to add the  
correct Accept header to the HTTP request before you send), and how to  
write JQuery Javascript via RJS – for example:

page[“#posts”].append render(:partial =\> ‘post’, :locals =\> {:post =\>  
@post})

outputs:

$(“#posts”).append(“Post #29 info…”);

… which JQuery can parse and execute successfully.

Interested to hear what others have been able to figure out with  
JQuery + Rails integration.

Geoff

---

<div class="post-metadata">

**Author:** ![johnlester](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@johnlester](https://www.ruby-forum.com/u/johnlester)\
**Post date:** [May 9, 2007, 8:01pm UTC](https://www.ruby-forum.com/t/jquery-and-rails/103727/4 "2007-05-09T20:01:09Z")

</div>

Sounds great Yehuda! I was just browsing your blog trying to find your  
email address. I look forward to checking out the plugin when it’s  
released.

Thanks,

John
