I want to display a partial when a button is clicked without refreshing the page.
This is what I attempted in my exploitation_controller
:
def show_content
respond_to do |format|
format.js
end
end
In routes.rb
:
get '/exploitation/show_content', to: 'exploitation#show_content', as: 'show_content'`
<%= link_to "Show", show_content_path, :remote => true %>
in my main view.
Then I include
$('#div_id').html("<%= render :partial => 'my_partial' %>");
in exploitation/show_content.js.erb
However, this leads to the following error : ActionController::UnknownFormat