title: "missing a template for this request format and variant." when trying to render AJAX response
body: <p>I'm trying to use a select_tag here to filter a list of kanji words. 
  My idea here is when user select options from dropdown -> auto submit form -> use AJAX to get to <code>search_by_lesson</code> action and fill data to #kanji_list. But I got 2 problem:</p>
  
  <ol>
  <li>While I have <code>remote: true</code> in my <code>form_tag</code>, When i select from dropdown, browser still navigates to a new page <code>http://localhost:3000/search_kanjis_by_lesson?lesson=1</code> but not stays at index page.</li>
  <li>The error in the title. While I want this <code>search_by_lesson</code> only render by ajax, I don't want to have a seperate <code>search_by_lesson.html.erb</code> in folders.</li>
  </ol>
  
  <p>Here's my <code>index.html.erb</code></p>
  
  <pre><code>&lt;%= form_tag search_kanjis_by_lesson_path(lesson: params[:lesson]), method: :get, remote: true do |f| %&gt;
      &lt;%= select_tag :lesson, options_for_select(@lessons), include_blank: true, onchange: "this.form.submit()" %&gt;
  &lt;% end %&gt;
  &lt;table class="ui celled padded striped table"&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Kanji&lt;/th&gt;
              &lt;th&gt;Meaning&lt;/th&gt;
              &lt;th&gt;Lesson&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody class="kanji_list"&gt;
          &lt;%= render 'index' %&gt;
       &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>I use a partial to render the list <code>_index.html.erb</code></p>
  
  <pre><code>&lt;% @kanjis.each do |kanji| %&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;%= kanji.word %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%= kanji.meaning %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%= kanji.lesson %&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>I got this in my routes </p>
  
  <pre><code>resources :kanjis
  
  get '/search_kanjis_by_lesson', to: 'kanjis#search_by_lesson', as: :search_kanjis_by_lesson
  </code></pre>
  
  <p>and in my kanjis_controllers.rb</p>
  
  <pre><code>class KanjisController &lt; ApplicationController 
  
      # ... other generic actions: edit, show ...
  
      def index
          @kanjis = Kanji.all
          @lessons = [*1..32]     # @lessons is just an array of int.
      end
  
      def search_by_lesson
          @kanjis = Kanji.find_by_lesson params[:lesson]
      end
  end
  </code></pre>
  
  <p>Finally, I have a search_by_lesson.js.erb</p>
  
  <pre><code>$("#kanji-list").html("&lt;%= escape_javascript(render 'index') %&gt;")
  </code></pre>