title: How to set to user selection after AJAX reload?
body: <p><code>#whs_id</code> is a drop down field on <code>partial form_list</code> of a Rails 4.2 page.</p>
  
  <pre><code>&lt;%= select_tag(:whs_id, options_for_select(return_misc_definitions('warehouse').map{|r| [r.name, r.id]}), include_blank: true) %&gt;&lt;/p&gt;
  </code></pre>
  
  <p>Here is the <code>.change</code> event for the <code>#whs_id</code>:</p>
  
  <pre><code>$(function() {
    $(document).on('change', '#whs_id', function (){  //only document/'body' works with every change. ('#whs_id') only works once.
      $.get(window.location, {whs_id: $('#whs_id').val()}, null, "script");
      return false;
    });
  });
  </code></pre>
  
  <p>Here is the <code>js</code> code to handle the <code>change</code> event and reload the <code>partial</code> <code>form_list</code> and set <code>#whs_id</code> to user's selection:</p>
  
  <pre><code>  &lt;% @items = @items.where(whs_id: params[:whs_id].to_i)  %&gt;
    $('#index_page').html("&lt;%= escape_javascript render partial: 'form_list', locals: {models: @items, whs_id: params[:whs_id]} %&gt;");
    $('#whs_id').val("&lt;%=params[:whs_id]%&gt;");  //set to user selection.
  </code></pre>
  
  <p>The problem is that after <code>ajax</code> reload, the <code>#whs_id</code> is always <code>blank</code> no matter what a user selects. The line of <code>$('#whs_id').val</code> does not set to the user's selection. What's is the right way to set to user's selection after <code>ajax</code> reload?</p>