I have a form in a side bar, and when the form submits, I need to refresh only that particular partial from the side bar, not the entire page. The partial has a div id = “class-id” on it.
partial.html.haml
- if class
// display some stuff
- else
= form_for [Class.new], remote: true do |f|
.field
= f.label :description
= f.text_field :description
.actions
= f.submit
I need to reload this partial after the submit is finished, so that the first if will be accessed.
Thanks
Create a view file as your action name, for example. – suppose your action name is
createinuser controllerthen in yourview/usersfolder create a filecreate.js.erband write below code in that file.For jquery
For prototype