title: Why does remote: true and confirm: 'Are You Sure?' not work together?
body: <p>I have been wrestling with Rails 4 and UJS and noticed that Rails 4.1 doesn't behave (specifically, rails-ujs) the way I would expect.  </p>
  
  <p>When using a remote link with a confirmation dialog, the UJS driver sends the XHR before the confirmation popup is approved (making the confirmation popup pointless).  I would have expected Rails to be able to handle this combination of options, but I had to write my own javascript to perform the confirmation popup and hook onto the "ajax:beforeSend" event to prevent the request from firing too soon.  </p>
  
  <p>Here's what I had that did not work (request fired immediately, did not wait for confirm dialog to return true):</p>
  
  <pre><code>= link_to 'Ajax Button', app_path(resource), method: :delete, 
      remote: true, id: 'ajax_link', disable_with: 'Wait...',
      confirm: 'Are you sure?'
  </code></pre>
  
  <p>Here's what I have now that does work:</p>
  
  <pre><code>= link_to 'Ajax Button', app_path(resource), method: :delete,
      remote: true, id: 'ajax_link', disable_with: 'Wait...'
  
  $ -&gt;
    $("a[data-remote]#ajax_link").on 'ajax:beforeSend', (xhr, settings) -&gt;
      return confirm("Are you sure?")
  </code></pre>
  
  <p>Is it just me or shouldn't rails/jquery-ujs handle the above combination of options and wait for the confirmation popup?  In the past, Rails 3 and prior, the remote links/buttons usually "just worked" when it came to AJAX and remote requests, but it seems with Rails 4 that working with AJAX requires a bit more finesse that was previously required.</p>
  
  <p>Has anyone else experienced this with Rails 4.1?  Any other solutions out there?  </p>