jquery - Rails 3 - render partial js.erb -


I have a simple search form that looks something like this:

App / view / Search /index.html. ARB & lt;% = form_for @search ,: as = & gt; : Search, Remote = & gt; True,: url = & gt; {: Action = & gt; "Query"},: html = & gt; {: Id = & gt; 'Search-form'}. F | & Gt%; ... & lt;% end% & lt; Div id = "search-results" & gt; & Lt; / Div & gt;

* AP / controller / search_controllerRB *

  DIF index @ search = search criteria.new enddef query @ search = search certificate.New ( Param [: search]) # Otherwise, search ... @ cremation = do_search @ search response_to do format | Format.js end end   

Then I have a js.erb template: * app / view / search / _query.js.erb *

  $ ( '# Search result'). Update ("& lt;% = escape_javascript (render (@shmijs))%>;);   

However, I can not see anything in the 'search-results' div. Do I need some type of template to render "Sassamari"? If so, what will be its name and where will I put it (i.e. app / scene / search?) (I am using jquery and rail 3)

thanks.

You should rename your template file:

  app / View / search / _query.js.erb = & gt; * App / view / search / query.js.erb   

Underscore is unnecessary

Comments