title: Return value of jquery UI dialog Box
body: <p>You may find solution over this in many posts(<a href="https://stackoverflow.com/questions/6049687/jquery-ui-dialog-box-need-to-return-value-when-user-presses-button-but-not-wor">Post 1</a> , <a href="https://stackoverflow.com/questions/3560872/returning-value-from-confirmation-dialog-using-jquery-ui-dialog">Post2</a> ), but their solution not working for me.</p>
  
  <p>Here is the normal jquery dialog box written by me.</p>
  
  <pre><code>$("#dialog").dialog({
          autoOpen:false,
          buttons:{
              "ok":function(){                                        
                          $(this).dialog("close"); 
                          return true;                                                                    
                      },
              "cancel":function(){                          
                          $(this).dialog("close");     return false;                  
                  }
              }   
  });
  </code></pre>
  
  <p>I will open the dialogbox with code:</p>
  
  <pre><code>var returnVal=$("#dialog").dialog("open");
  </code></pre>
  
  <p>I need to return <code>false</code>,if user clicks 'cancel' and  return <code>true</code> if user clicks 'ok'.</p>
  
  <pre><code>var returnVal=$("#dialog").dialog("open");
  </code></pre>
  
  <p>I NEED <code>returnVal</code> to return <code>boolean</code> value(true/false), but it returns javascript <code>object</code>.</p>