# Ajax form for-how to refresh the \<div\> without any layout?

**URL:** <https://www.ruby-forum.com/t/ajax-form-for-how-to-refresh-the-div-without-any-layout/118252>\
**Category:** Rails\
**Created:** [October 25, 2007, 5:03am UTC](https://www.ruby-forum.com/t/ajax-form-for-how-to-refresh-the-div-without-any-layout/118252 "2007-10-25T05:03:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ghee\_wooi\_O](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f475e1/32.png) [@Ghee\_wooi\_O](https://www.ruby-forum.com/u/Ghee_wooi_O)\
**Post date:** [October 25, 2007, 5:03am UTC](https://www.ruby-forum.com/t/ajax-form-for-how-to-refresh-the-div-without-any-layout/118252/1 "2007-10-25T05:03:11Z")

</div>

hi,

I got an ajax form that can post values to controller to create  
item.(simply an form\_remote\_for )then redirect to another page.

however, the response is include the app/view/layout/application.rthml.  
so my refresh

 nested into another page.

is that any better way to doing this?

---

<div class="post-metadata">

**Author:** ![Ghee\_wooi\_O](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f475e1/32.png) [@Ghee\_wooi\_O](https://www.ruby-forum.com/u/Ghee_wooi_O)\
**Post date:** [October 25, 2007, 5:20am UTC](https://www.ruby-forum.com/t/ajax-form-for-how-to-refresh-the-div-without-any-layout/118252/2 "2007-10-25T05:20:12Z")

</div>

Ghee wooi Ong wrote:

> hi,
> 
> I got an ajax form that can post values to controller to create  
> item.(simply an form\_remote\_for )then redirect to another page.
> 
> however, the response is include the app/view/layout/application.rthml.  
> so my refresh
> 
> nested into another page.
> 
> is that any better way to doing this?
> 
> Hi,  
> I did’n get you. Anyway In order to refresh a particular div I uasually  
> use :update =\>“divname”

---

<div class="post-metadata">

**Author:** ![Ghee\_wooi\_O](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f475e1/32.png) [@Ghee\_wooi\_O](https://www.ruby-forum.com/u/Ghee_wooi_O)\
**Post date:** [October 25, 2007, 5:32am UTC](https://www.ruby-forum.com/t/ajax-form-for-how-to-refresh-the-div-without-any-layout/118252/3 "2007-10-25T05:32:38Z")

</div>

my code look like this:

\<% form\_remote\_for :location, :update=\>‘content’, :url =\> ‘/create’,  
:html=\>{:id =\>‘location’} do |f| %\>

…

\<% end %\>

I had a

content
 in my page, so it will be replace my the ajax  
response.  
but the only thing is it include the layout which I don’t want.

is that any way to discard the layout?

---

<div class="post-metadata">

**Author:** ![Ghee\_wooi\_O](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f475e1/32.png) [@Ghee\_wooi\_O](https://www.ruby-forum.com/u/Ghee_wooi_O)\
**Post date:** [October 25, 2007, 9:03am UTC](https://www.ruby-forum.com/t/ajax-form-for-how-to-refresh-the-div-without-any-layout/118252/4 "2007-10-25T09:03:40Z")

</div>

ok thx !

---

<div class="post-metadata">

**Author:** ![Ghee\_wooi\_O](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f475e1/32.png) [@Ghee\_wooi\_O](https://www.ruby-forum.com/u/Ghee_wooi_O)\
**Post date:** [October 25, 2007, 5:35am UTC](https://www.ruby-forum.com/t/ajax-form-for-how-to-refresh-the-div-without-any-layout/118252/5 "2007-10-25T05:35:18Z")

</div>

Ghee wooi Ong wrote:

> my code look like this:
> 
> \<% form\_remote\_for :location, :update=\>‘content’, :url =\> ‘/create’,  
> :html=\>{:id =\>‘location’} do |f| %\>
> 
> …
> 
> \<% end %\>
> 
> I had a
> 
> content
> in my page, so it will be replace my the ajax  
> response.  
> but the only thing is it include the layout which I don’t want.
> 
> is that any way to discard the layout?

In the controller when you can give like  
render\_without\_layout : “view file name”  
this will help I hope
