# Can Ajax updates more than one \<div\>?

**URL:** <https://www.ruby-forum.com/t/can-ajax-updates-more-than-one-div/53809>\
**Category:** Rails\
**Created:** [February 14, 2006, 7:57pm UTC](https://www.ruby-forum.com/t/can-ajax-updates-more-than-one-div/53809 "2006-02-14T19:57:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [February 14, 2006, 7:57pm UTC](https://www.ruby-forum.com/t/can-ajax-updates-more-than-one-div/53809/1 "2006-02-14T19:57:54Z")

</div>

Hi,

I wish to know, is it possible that Ajax can update  
more than one zone “

”??? like :

\<%= link\_to\_remote(“Title”, :update =\> ‘mydiv0’, :url  
=\> {:action=\>:say\_hello} )%\>

 to be changed one

 to be changed two

When I execute the code, only the first line is  
changed, the second one doesn’t…

thanks you very much

Saiho

* * *

Do You Yahoo!?  
Tired of spam? Yahoo! Mail has the best spam protection around

> **[Yahoo Mail - Organized Email](https://mail.yahoo.com)**
>
> It's time to get stuff done with Yahoo Mail. Just add your Gmail, Outlook, AOL or Yahoo Mail to get going. We automatically organize all the things life throws at you, like receipts and attachments, so you can find what you need fast. Plus, we've got...

---

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [February 14, 2006, 8:03pm UTC](https://www.ruby-forum.com/t/can-ajax-updates-more-than-one-div/53809/2 "2006-02-14T20:03:58Z")

</div>

The link\_to\_remote will only update one DOM element. You may want to  
look into RJS templates…they will allow you to do multiple updates  
on a single AJAX call.

-Derrick S.

---

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [February 14, 2006, 8:16pm UTC](https://www.ruby-forum.com/t/can-ajax-updates-more-than-one-div/53809/3 "2006-02-14T20:16:03Z")

</div>

There is a section in “Rails Recipes” that talks about using RJS to do  
this.

---

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [February 14, 2006, 8:40pm UTC](https://www.ruby-forum.com/t/can-ajax-updates-more-than-one-div/53809/4 "2006-02-14T20:40:24Z")

</div>

Ditto to both comments above.  
I was looking for the exact same thing, and RJS seems to be one of the  
only  
sane ways to do this.
