title: JQuery confirmation dialog
body: <p>I am looking for an way to implement a reusable "confirm" Dialog with JQuery.. </p>
  
  <p>This is the part from the MyApp Class to open the dialog:</p>
  
  <pre><code>/**
   * @param text string Message to display
   */
  getConfirmationDialog: function(text) {
     MyApp.confirmDialog = $('&lt;div&gt;&lt;p&gt;' + text + '&lt;/p&gt;&lt;/div&gt;');
     MyApp.confirmDialog
      .dialog({
          modal: true,
          autoOpen: false,
          title: 'Please confirm',
          width: 300,
          height: 180,
          buttons: {
              'OK': function() {
                  return true;
              },
              Cancel: function() {
                  $(this).dialog('close');
                  return false;
              }
          }
      });
  
      MyApp.confirmDialog.dialog('open');
  },
  </code></pre>
  
  <p>In another class I do:</p>
  
  <pre><code>/**
   * Clear system cache
   *
   * @param url string Backend URL
   */
  clearCache: function(url) {
  
      dialog = MyApp.getConfirmationDialog('Clear cache?');
  
      //dialog returns true..
      if (dialog) {
          MyApp.admin.dashboard.doClearCache();
      }
  
  },
  </code></pre>
  
  <p>But I have no idea to do this the "right" way.. the dialog can't return an value or?</p>