# Update specific div using post request

**URL:** <https://www.ruby-forum.com/t/update-specific-div-using-post-request/157123>\
**Category:** Rails\
**Created:** [January 7, 2009, 4:53pm UTC](https://www.ruby-forum.com/t/update-specific-div-using-post-request/157123 "2009-01-07T16:53:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@sunfish](https://www.ruby-forum.com/u/sunfish)\
**Post date:** [January 7, 2009, 4:53pm UTC](https://www.ruby-forum.com/t/update-specific-div-using-post-request/157123/1 "2009-01-07T16:53:02Z")

</div>

It is possible to update specific div in my rhtml file using post  
request like ajax do?

---

<div class="post-metadata">

**Author:** ![sunfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@sunfish](https://www.ruby-forum.com/u/sunfish)\
**Post date:** [January 9, 2009, 10:33am UTC](https://www.ruby-forum.com/t/update-specific-div-using-post-request/157123/2 "2009-01-09T10:33:42Z")

</div>

It is possible to update a specific div using a post request like AJAX  
do.  
you need to use link\_to\_remote method for this.

What does this link\_to\_remote method does…

Returns a link to a remote action defined by options[:url] (using the  
url\_for format) that’s called in the background using XMLHttpRequest.  
The  
result of that request can then be inserted into a DOM object whose id  
can  
be specified with options[:update]. Usually, the result would be a  
partial  
prepared by the controller with render :partial.  
(from apis)  
eg.

link\_to\_remote (“Delete”, :update=\>“posts”, :url=\> {:action =\>“destroy”,  
:id=\>post.id})

the above function call will generate a link called Delete which when  
called  
will delete the item specified by the id and simultaneously update the  
div  
having the id “posts” without reloading the page.

link\_to\_remote requests are posts so don’t need to worry about it.
