title: Jquery dialog buttons return value
body: <p>I am using a jquery dialog, and what i want to implement is when user press "ok“， the progamming keep going, when press "cancel", it stoped. </p>
  
  <pre><code>    function displaymessage()
  {
   $("#confirm").dialog({      
      buttons:{
                  "OK":function(){$(this).dialog("close"); test(1);},
                  "Cancel":function(){$(this).dialog("close");test(0);}        
              }
          });  
  function test(bool)
  {
  if(bool==1)
  return true;
  else return false;
  }
  return test();
  }
  
  
  
  &lt;div id="confirm"&gt;&lt;/div&gt;
  &lt;input type="button" value="Click me!" onclick="return displaymessage()" /&gt;
  </code></pre>
  
  <p>But how to control the function test run after user click "ok" button?</p>
  
  <p>thanks</p>
  
  <p>​​​​​</p>