# Ajax: update multiple DIV's

**URL:** <https://www.ruby-forum.com/t/ajax-update-multiple-divs/62318>\
**Category:** Rails\
**Created:** [June 2, 2006, 6:15pm UTC](https://www.ruby-forum.com/t/ajax-update-multiple-divs/62318 "2006-06-02T18:15:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zven](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/77aa72/32.png) [@zven](https://www.ruby-forum.com/u/zven)\
**Post date:** [June 2, 2006, 6:15pm UTC](https://www.ruby-forum.com/t/ajax-update-multiple-divs/62318/1 "2006-06-02T18:15:39Z")

</div>

Hello.

Is it possible to update multiple DIVs during? For example I have DIV  
for @flash[:notice], and one for content and I need to render both DIVs  
after executing action.

---

<div class="post-metadata">

**Author:** ![zven](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/77aa72/32.png) [@zven](https://www.ruby-forum.com/u/zven)\
**Post date:** [June 3, 2006, 7:05pm UTC](https://www.ruby-forum.com/t/ajax-update-multiple-divs/62318/2 "2006-06-03T19:05:56Z")

</div>

If I understand your question correctly, RJS will make this a snap. The  
new RJS is wickedly cool - give it a whirl. Here’s some docs:

- [http://www.codyfauser.com/articles/2005/11/20/rails-rjs-templates](http://www.codyfauser.com/articles/2005/11/20/rails-rjs-templates)
- [http://scottraymond.net/articles/2005/12/01/](http://scottraymond.net/articles/2005/12/01/)  
real-world-rails-rjs-templates

Here’s some code I wrote recently for my new Mac Password Manager:

```
render :update do |page|
  if saved
    page.hide "form"
    page.replace_html "status", 'Thank you! Your message has been 

```

sent.’  
else  
page.replace\_html “status”, ‘Please enter the message.’  
end  
end

You can do all sorts of cool things with that “page” object, including  
visual effects a-la [script.aculo.us](http://script.aculo.us). See [http://api.rubyonrails.org/](http://api.rubyonrails.org/)  
classes/ActionView/Helpers/PrototypeHelper/JavaScriptGenerator/  
GeneratorMethods.html for details.

HTH.

On Friday, June 02, 2006, at 10:15 PM, zven wrote:

> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)  
> Cheers!  
> –Dave T.  
> [http://1passwd.com](http://1passwd.com) - Password Manager + AutoFill for Mac OS X  
> [http://devlists.com](http://devlists.com) - Email list management  
> [http://palmsphere.com](http://palmsphere.com) - Apps for your hand-held
