title: jQuery UI Dialog confirmation
body: <p>I'm trying to use the jQuery UI Dialog to display a confirmation prior to executing the action...in this case navigating to the selected link....but in another case, I might like to use AJAX delete.</p>
  
  <p>I thought I could pass the action as parameter of the custom_confirm function:</p>
  
  <pre><code>   $("a.edit").click(function(e){
         e.preventDefault();
         custom_confirm('Please Note:',
             function(){
                 location.href = $(this).attr('href');
             }
         );
     });
  
     function custom_confirm(prompt, action, title){
      if (title === undefined) title = "Are you sure?";
      if ($("#confirm").length == 0){
          $("#main div.inner").append('&lt;div id="confirm" title="' + title + '"&gt;' + prompt + '&lt;/div&gt;');
          $("#confirm").dialog({buttons: {'Proceed': function(){ $(this).dialog('close'); action; }, Cancel: function(){ $(this).dialog('close'); }}});
      }
      else {
          $("#confirm").html(prompt);
          $("#confirm").dialog('open');
      }
  }
  </code></pre>
  
  <p>It's not working.  Is there another way to accomplish this?</p>
  
  <hr>
  
  <p>Thanks for the quick responses guys. I tried your suggestion, but it's still not executing function that is passed as parameter.</p>
  
  <pre><code>    $("a.edit").click(function(e){
         e.preventDefault();
         var href = $(this).attr('href');
         custom_confirm('Please Note:',
             function(){
  console.log(href);
                 location.href = href;
             }
         );
     });
  </code></pre>
  
  <hr>
  
  <p>Cleaned up the custom_confirm function, added the close option:</p>
  
  <pre><code>function custom_confirm(prompt, action, title){
      if (title === undefined) title = "Are you sure?";
      $("#main div.inner").append('&lt;div id="confirm" title="' + title + '"&gt;' + prompt + '&lt;/div&gt;');
      $("#confirm").dialog({position: 'top', width: 700, modal: true, resizable: false, show: "fold", hide: "blind", buttons: {'Proceed': function(){ $(this).dialog('close'); action(); }, Cancel: function(){ $(this).dialog('close'); }}, close: function(ev, ui) { $(this).remove();}});
  }
  </code></pre>