title: respond_to not rendering index.js.erb properly
body: <p>I've searched high and low for an answer to this and have yet to find anything that resolves my issues. I have a page that displays a message board from all users, and each message board has a "game_type" attribute tied to it. I'm simply trying to update all of the messages without refreshing using ajax. I've set up scopes, and my controller currently looks like this:</p>
  
  <pre><code>def index
      @microposts = Micropost.where(nil).paginate(page: params[:page], per_page: 12)
      filtering_params(params).each do |key, value|
        @microposts = @microposts.public_send(key, value) if value.present?
      end
      @micropost = current_user.microposts.build 
  
      respond_to do |format|
          format.html { }
          format.js { }
      end
  
  end
  </code></pre>
  
  <p>If I have just a standard link on my page such as <code>&lt;%= link_to 'Mode', {controller: 'microposts', action: 'index', :game_type =&gt; 'Mode'} %&gt;</code> my browser redirects to <a href="http://localhost:3000/microposts?game_type=Mode" rel="nofollow noreferrer">http://localhost:3000/microposts?game_type=Mode</a> and displays the correct results. Now the issue occurs when trying to make the ajax magic happen so I can skip the redirect and render the results live on page. </p>
  
  <p>Amongst other things, I have this form in my index.html.erb view:</p>
  
  <pre><code>&lt;%= form_tag microposts_path, method: :get, remote: true do %&gt;
      &lt;%= select_tag :game_type, options_for_select([['Mode', 'Mode'], ['Mode2', 'Mode2']]), onchange: 'this.form.submit()' %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>Which allows the user to filter the results through a select. I have an index.js.erb file that contains the following line:</p>
  
  <pre><code>$(.row.posts").html("&lt;%= j (render @microposts) %&gt;");`
  </code></pre>
  
  <p>However, when selecting a value from the drop down, my <code>format.js</code> block is not getting hit at all, and it's treating my request as HTML. The only way I've found to get around this is by adding <code>microposts_path(:format =&gt; :js)</code> to my form. This <em>kind of</em> works. First, I was getting a cross-origin error, which I resolved by adding <code>protect_from_forgery except: :index</code> to my controller. Now, my format.js block is hit and it's calling my index.js.erb. However, the JS calls in that file that I have are being rendered as text, and I am redirected to a blank page with just <code>$(.row.posts").html("the html of my rendered posts");</code> </p>
  
  <p>Nothing in that file is actually treated as JS. I noticed in my browser console that I am getting this error: </p>
  
  <pre><code>Resource interpreted as Document but transferred with MIME type text/javascript: "http://localhost:3000/microposts.js?utf8=%E2%9C%93&amp;game_type=Mode".
  </code></pre>
  
  <p>The weird thing is, I have create and destroy actions that handle this just fine. My application.js file has both </p>
  
  <pre><code>//= require jquery
  //= require jquery_ujs 
  </code></pre>
  
  <p>And I don't have any need to pass in <code>format: :js</code> with my other actions. Please help!! I may be way off base with the way I'm handling this from the get go, I cannot find anything that has been able to work for this!</p>