I have this incredible simple form:
<%= form_tag(\"/portal/search\", method: \'get\', remote: true ) do %>
<%= label_tag(:query, \'Search for:\')
Let's say you get @results out of your search method.
In the controller, search method:
respond_to do |format|
format.html {render or redirect_to wherever you need it}
format.js
end
Then all you need is a file named search.js.erb to run the required js at the end of your request. It might look something like:
$('#results_div').html("<%= j @results.pluck(:title).join('
') %>")