title: How to call a function with jQuery Dialog OK button?
body: <p>I am trying to call a function from Jquery dialog box <code>Ok</code> button.</p>
  <p>I have tried these two methods,</p>
  <h1>1</h1>
  <pre><code>this.commentDialog = function(){
          $(&quot;#commentDialog&quot;).dialog( &quot;destroy&quot; );
          html = &quot;&lt;div id='cmtDialog'&gt;&quot;;
          html += &quot;Comment&lt;textarea id='comment'&gt;&lt;/textarea&gt;&lt;/div&gt;&quot;;
          $(&quot;#commentDialog&quot;).html(html);
          $(&quot;#commentDialog&quot;).dialog({
              title:&quot;Search Result&quot;,
              bgiframe: true,
              height: 'auto',
              width: 'auto',
              modal: true,autoOpen: true,
              buttons: { &quot;Ok&quot;: function() { this.saveComment();}}
              });
  </code></pre>
  <h1>2</h1>
  <pre><code>this.commentDialog = function(){
          $(&quot;#commentDialog&quot;).dialog( &quot;destroy&quot; );
          html = &quot;&lt;div id='cmtDialog'&gt;&quot;;
          html += &quot;Comment&lt;textarea id='comment'&gt;&lt;/textarea&gt;&lt;/div&gt;&quot;;
          $(&quot;#commentDialog&quot;).html(html);
          $(&quot;#commentDialog&quot;).dialog({
              title:&quot;Search Result&quot;,
              bgiframe: true,
              height: 'auto',
              width: 'auto',
              modal: true,autoOpen: true,
              buttons: { &quot;Ok&quot;: function() { saveComment();}}
              });
  </code></pre>
  <p>Both not working!</p>
  <p>How shall i do it with jquery!!</p>
  <p>Thanks!!!</p>