title: jQuery dialog confirm before opening link
body: <p>I have a table populated with data from the database, where each row has a cell with an anchor element inside. This anchor would lead to the same page but with a query string telling php which row contains the data it should delete.</p>
  
  <p>I need a jQuery dialog box to be opened when the user clicks an anchor asking him to confirm his intentions BEFORE loading the url. The 'cancel' button should close the dialog and do nothing. The 'OK' button should then let the url open.</p>
  
  <p>Any help is highly appreciated.</p>
  
  <p>// edit with 'what I have tried'. It's my first time messing with jQuery and time for studying is running out... =(</p>
  
  <pre><code>jQuery(document).ready(function(){
  var $dialog = jQuery('&lt;div class='msg_dialog'&gt;&lt;/div&gt;')
      .html('Are you sure you want to do this?')
      .dialog({
          autoOpen: false,
          title: 'Confirm action',
          buttons: [{
              text: "Cancel",
              click: function(){
                  jQuery(this).dialog("close");
              }
          }] // didn't even try the OK button since I couldn't even get the dialog opened
      });
  
  jQuery('#confirm_del').click(function(){
      $dialog.dialog('open');
      return false;
  });
  });
  </code></pre>