title: Rails 5 Bootstrap 3 Modal / Ajax not working
body: <p>I am building out an app in Rails 5 and using Bootstrap 3 for the framework. </p>
  
  <p>I have created a custom user controller ect to allow admins to create / edit and destroy users. I am setting up modals for the create user form, the modal its self works, however I want it to automatically place and render the table row. </p>
  
  <p>So far when I create a user the modal hangs, it creates the user but dose not close the modal window and if I reopen the modal from the button it still holds the previous users email and details. </p>
  
  <p>I will say that I have placed format.js in the Create, Update and Destroy Controller Actions under format.</p>
  
  <blockquote>
    <p><strong>My Modal and Its Button</strong></p>
  </blockquote>
  
  <pre><code>&lt;!-- Button trigger modal --&gt;
  &lt;button type="button" class="btn btn-primary" data-toggle="modal" data-target="#userCreate"&gt;
    Add New User
  &lt;/button&gt;
  
  &lt;!-- Modal --&gt;
  &lt;%= form_for(@user, remote: true) do |f| %&gt;
    &lt;div class="modal fade bs-example-modal-lg" id="userCreate" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"&gt;
      &lt;div class="modal-dialog" role="document"&gt;
        &lt;div class="modal-content"&gt;
          &lt;div class="modal-header"&gt;
            &lt;button type="button" class="close" data-dismiss="modal" aria-label="Close"&gt;&lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;&lt;/button&gt;
            &lt;h4 class="modal-title" id="myModalLabel"&gt;&lt;i class="fa fa-user-plus" aria-hidden="true"&gt;&lt;/i&gt; User Creation&lt;/h4&gt;
          &lt;/div&gt;
          &lt;div class="modal-body"&gt;
            &lt;div class="row"&gt;
              &lt;div class="col-xs-12"&gt;
                &lt;div class="field"&gt;
                  &lt;%= f.label :email, "Email Address - Password Will Be Sent To This Address" %&gt;&lt;br /&gt;
                  &lt;%= f.email_field :email, autofocus: true, :class =&gt; 'form-control email' %&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;
  
            &lt;div class="row"&gt;
              &lt;div class="col-xs-12 col-sm-6"&gt;
                &lt;div class="field"&gt;
                  &lt;%= f.label :f_name, "First Name" %&gt;
                  &lt;%= f.text_field :f_name, :class =&gt; 'form-control f_name' %&gt;
                &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class=""&gt;
  
              &lt;/div&gt;
              &lt;div class="col-xs-12 col-sm-6"&gt;
                &lt;div class="field"&gt;
                  &lt;%= f.label :l_name, "Last Name" %&gt;
                  &lt;%= f.text_field :l_name, :class =&gt; 'form-control l_name' %&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;
            &lt;div class="row"&gt;
              &lt;div class=""&gt;
  
              &lt;/div&gt;
              &lt;div class="col-xs-12"&gt;
                &lt;div class="field"&gt;
                  &lt;%= f.label :primary_tel, "Primary Telephone" %&gt;
                  &lt;%= f.text_field :primary_tel, :class =&gt; 'form-control primary_tel' %&gt;
                &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class=""&gt;
  
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="modal-footer"&gt;
            &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Close&lt;/button&gt;
            &lt;%= f.submit "Create User", :class =&gt; 'btn btn-primary' %&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <blockquote>
    <p><strong>Index Page where the _user_row.html.erb Partial is to be rendered</strong></p>
  </blockquote>
  
  <pre><code>&lt;table&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;User ident&lt;/th&gt;
        &lt;th&gt;F name&lt;/th&gt;
        &lt;th&gt;L name&lt;/th&gt;
        &lt;th&gt;Primary tel&lt;/th&gt;
        &lt;th&gt;Role&lt;/th&gt;
        &lt;th colspan="3"&gt;&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
  
    &lt;tbody&gt;
      &lt;% @users.each do |user| %&gt;
        &lt;div class="row" id="user_table_row"&gt;
          &lt;%= render partial: 'user_row', locals: {user: user} %&gt;
        &lt;/div&gt;
      &lt;% end %&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Now this partial is displaying, but only after I manually reload the page</p>
  
  <blockquote>
    <p><strong>And finally the create.js.erb file (located in views/users)</strong></p>
  </blockquote>
  
  <pre><code>$('#userCreate').modal('hide'); &lt;-- close the Modal On Submit
  $(".email").val('');            &lt;-- Reset Email Field
  $(".f_name").val('');           &lt;-- Reset F_name Field
  $(".l_name").val('');           &lt;-- Reset L_name Field
  $(".primary_tel").val('');      &lt;-- Reset Telephone Field
  
  $('#user_table_row').prepend('&lt;%= j render @user %&gt;');       &lt;-- Render User
  $('#user_row_&lt;%= user.user_ident %&gt;').hide().fadeIn(1000);   &lt;-- Display Row
  </code></pre>
  
  <p>I am newish to jquery but im stumped here.. Any help would be greatly appreciated! Please let me know if you need to see anything else. Thanks. </p>
  
  <p>also the &lt;-- is not present in my app code i placed these there so you know what i am trying to do. </p>