title: Rails 3 - render partial js.erb
body: <p>I have a simple search form that looks something like:</p>
  
  <p><em>app/views/search/index.html.erb</em></p>
  
  <pre><code>&lt;%= form_for @search, :as =&gt; :search, :remote =&gt; true, :url =&gt; {:action =&gt; "query"}, :html =&gt; {:id =&gt; 'search-form'} do |f| %&gt;
    ...
  &lt;% end %
  
  &lt;div id="search-results"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>*app/controllers/search_controller.rb*</p>
  
  <pre><code>def index
    @search = SearchCriteria.new
  end
  
  def query
    @search = SearchCriteria.new(params[:search])
  
        # otherwise, perform search...
    @summaries = do_search @search
    respond_to do |format|
      format.js
    end
  end
  </code></pre>
  
  <p>I then have a js.erb template:
  *app/views/search/_query.js.erb*</p>
  
  <pre><code>$('#search-results').update("&lt;%= escape_javascript(render(@summaries)) %&gt;");
  </code></pre>
  
  <p>However, I don't see anything being put into the 'search-results' div. Do I need some sort of template in order to render "@summaries"? If so, what would it be named and where would I place it (i.e. app/views/search?) (i am using jquery and rails 3)</p>
  
  <p>Thanks.</p>