I have a search form in a modal
as below:
<%= form_tag "/search", :remote => true, :method => :get do %>
<input type="text" name="search_name">
<button type="submit">Search</button>
<% end %>
<div id="channels"></div>
the above form invoke below method in my controller:
#my_controller.rb:
def search
parsed_json = JSON.parse(@json_string) # fetch some json data
render do |index|
ndex.html {}
index.js {}
end
end
so I expect the above search method to render below index.js.erb
from app/view/my_controller
to update my div
:
$("#channels").html("<%= render :partial => "channels" %>")
after clicking the search button the view can not be updated because index.js.erb
can not be invoked, any idea?
P.S: I am using rails 3.2