title: Rails "Bootstrap loading button" in Ajax
body: <p>I have a list of Users and I want Admin to sent password to those users with a button.
  So I saw bootstrap buttons javascript plugin and I used the loading one.</p>
  
  <p><strong>This is the index.html</strong> </p>
  
  <pre><code>&lt;table&gt;
  &lt;% @users.each do |user| %&gt;
  
  &lt;td&gt;
   &lt;dl&gt;
    &lt;dt&gt;&lt;%= user.name %&gt;&lt;/dt&gt;
   &lt;/dl&gt;
  &lt;/td&gt;
  
  &lt;td&gt;&lt;%= link_to 'show', admin_user_path(user.id) %&gt;&lt;/td&gt;
  &lt;td&gt;&lt;%= button_to 'Send password', send_mail_path(user.id), remote: true, class: "btn btn-primary", :form =&gt; {:"data-loading-text" =&gt; "wait ..."}   %&gt;&lt;/td&gt;
  
  &lt;% end %&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>which ends in this html:</p>
  
  <pre><code>&lt;table&gt;
  
  &lt;tbody&gt;
   &lt;td&gt;
    &lt;dl&gt;&lt;dt&gt;Jonh&lt;/dt&gt;&lt;/dl&gt;
   &lt;/td&gt;
  
   &lt;td&gt;&lt;form method="post" data-remote="true" data-loading-text="attendi ..." class="button_to" action="/admin/users/send_mail/26"&gt;
     &lt;div&gt;&lt;input type="submit" value="send password" class="btn btn-primary"&gt;
       &lt;input type="hidden" value="bLGRJ1j9Hv75PsN4fuma0NlmYwAbS//1l884ShOotcw=" name="authenticity_token"&gt;&lt;/div&gt;
     &lt;/form&gt;&lt;/td&gt;
  </code></pre>
  
  <p>And in admin assets/javascript/admin/users I have <strong>index.js.erb</strong></p>
  
  <pre><code>$('.btn').button();
  
  $(document).ready(function(){
    $('.btn').click(function() {
      $(this).button('loading');
    });
  });
  </code></pre>
  
  <p>But the loading animation doesn't work. Any suggestion? I am very new to both rails and jquery</p>