# RoR and Ajax

**URL:** <https://www.ruby-forum.com/t/ror-and-ajax/109809>\
**Category:** Rails\
**Created:** [July 19, 2007, 8:34am UTC](https://www.ruby-forum.com/t/ror-and-ajax/109809 "2007-07-19T08:34:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![oracleofmist](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/45deac/32.png) [@oracleofmist](https://www.ruby-forum.com/u/oracleofmist)\
**Post date:** [July 19, 2007, 8:34am UTC](https://www.ruby-forum.com/t/ror-and-ajax/109809/1 "2007-07-19T08:34:56Z")

</div>

I want to use RoR and its built-in Ajax functions to display a list of  
objects on a page like so:

* * *

## Item 1 Item 2 Item 3

each item, when clicked on will load a description of the item. I want  
to do this w/out loading another page and just want it rendered on the  
same page. Is this possible or am i overstepping functionality here?

Example…from the list above, say i click item 2 like so:

* * *

## Item 1 Item 2 _click_ Item 3

* * *

## back Item 2 Info…blah blah blah more info on item 2…

---

<div class="post-metadata">

**Author:** ![oracleofmist](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/45deac/32.png) [@oracleofmist](https://www.ruby-forum.com/u/oracleofmist)\
**Post date:** [July 19, 2007, 8:50am UTC](https://www.ruby-forum.com/t/ror-and-ajax/109809/2 "2007-07-19T08:50:21Z")

</div>

Certainly is possible. You’ll want to use a combination of hidden DIVs  
and RJS to show those DIVs again. Before showing the DIV you can also  
replace the contents of the DIV using RJS.

Lots 'o tutorials floating around on the web.

–  
Roderick van Domburg

> **[De domeinnaam Nedforce.nl is te koop.](http://www.nedforce.nl)**
>
> Deze mooie domeinnaam kan al over een paar minuten van jou zijn. Betalen gaat eenvoudig en vertrouwd via iDEAL. Direct na de betaling ontvang je de verhuiscode per e-mail en kun je aan de slag.

---

<div class="post-metadata">

**Author:** ![oracleofmist](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/45deac/32.png) [@oracleofmist](https://www.ruby-forum.com/u/oracleofmist)\
**Post date:** [July 19, 2007, 4:54pm UTC](https://www.ruby-forum.com/t/ror-and-ajax/109809/3 "2007-07-19T16:54:40Z")

</div>

I did something similiar with a credit card list, but I think if you had  
a list and a hidden div and then set up your list items as links using  
the link\_to\_remote helper you could then use the :update symbol to  
update that hidden div without reloading the page.

\<%= link\_to\_remote ‘Delete’, :url =\> { :action =\> ‘delete\_credit\_card’  
}, :update =\> ‘credit\_card\_table’ %\>

credit\_card\_table would be my hidden div. Then in my delete\_credit\_card  
method I could render :partial or render\_text so that when the :update  
happens it knows what to update with.

Hope this helps, good luck,

~S

---

<div class="post-metadata">

**Author:** ![oracleofmist](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/45deac/32.png) [@oracleofmist](https://www.ruby-forum.com/u/oracleofmist)\
**Post date:** [July 20, 2007, 1:53am UTC](https://www.ruby-forum.com/t/ror-and-ajax/109809/4 "2007-07-20T01:53:27Z")

</div>

Roderick van Domburg wrote:

> Certainly is possible. You’ll want to use a combination of hidden DIVs  
> and RJS to show those DIVs again. Before showing the DIV you can also  
> replace the contents of the DIV using RJS.
> 
> Lots 'o tutorials floating around on the web.
> 
> –  
> Roderick van Domburg  
> [http://www.nedforce.nl](http://www.nedforce.nl)

would you mind linking me to some of these as i am unable to find them.  
At least in any sort of manner that i can understand. thanks
