title: unobtrusive javascript confirm using bootstrap modal (bootbox)
body: <p>I have a link in my MVC application:</p>
  
  <pre><code>&lt;a class="btn  btn-default" confirm="Are you sure you want to delete the selected group? This action cannot be undone!" data-ajax="true" data-ajax-method="GET" data-ajax-mode="replace" data-ajax-update="#TabsId-5" href="/Groups/DeleteGroup/38" id="btnDelGrp"&gt;&lt;i class="glyphicon glyphicon-remove"&gt;&lt;/i&gt; Delete Selected Group&lt;/a&gt;
  </code></pre>
  
  <p>and the following js:</p>
  
  <pre><code>$(document).ready(function ()
  {
  $("[confirm]").each(function () {
      $(this).click(function (e) {
          e.preventDefault();
          var action = function () { alert("no action"); };
          switch ($(this).prop('tagName'))
          {
              case 'A':
                  var url = $(this).attr("href");
                  action = function () { document.location.href = url; };
                  break;
              case 'BUTTON':
                  var form = $(this).closest('form');
                  if ($(this).attr("name") != "" &amp;&amp; $(this).attr("value") != "")
                  {
                      var foundIndex = $(form).attr('action').indexOf($(this).attr("name"));
                      if (foundIndex == -1) //don't add the same param over and over
                      {
                          $(form).attr('action', $(form).attr('action') + "?" + $(this).attr("name") + "=" + $(this).attr("value"));
                      }
                      else //else replace it
                      {
                          $(form).attr('action', $(form).attr('action').substring(0, foundIndex) + $(this).attr("name") + "=" + $(this).attr("value"));
                      }
                  }
                  action = function () { form.submit(); };
                  break;
          }
          bootbox.confirm($(this).attr("confirm"), function (result) {
              if (result)
                  action();
          });
      });
  });
  });
  </code></pre>
  
  <p>I'm having the issue where the link is firing after the dialog shows no matter what. The unobtrusive ajax doesn't seem to respect the <code>preventDefault</code>. I know there is a workaround using the <code>data-ajax-confirm</code> option, but this uses the generic js alert popup. Is there a way to get these two things to work together?</p>