Update specific div using post request

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

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs