title: submit form after confirmation by jquery dialog for payment
body: <p>I have a  book now submit button for payment gateway.</p>
  
  <p>The dialog box is not staying its submitting the form without confirming.</p>
  
  <p>How to stop submitting form.</p>
  
  <p>Here is code :</p>
  
  <pre><code>var submitForm = $('#paypal');
  submit = false;
  
  $("#confirm").dialog({
      resizable: false,
      height: 140,
      modal: true,
      autoOpen: false,
      buttons: {
          'Submit': function() {
              $(this).dialog('close');
              submit = true;
              submitForm.submit();
          },
          'Cancel': function() {
              $(this).dialog('close');
          }
      }
  });
  $("#confirm").parent().appendTo($("#paypal")); 
  
  submitForm.submit(function() {
      if (submit) {
          return true;
      } else {
          $("#confirm").dialog('open');
          return false;
      }
  });
  </code></pre>
  
  <p>HTML code hidden values are removed:</p>
  
  <pre><code>&lt;form id="paypal" name="paypal" method='post' action="https://www.sandbox.paypal.com/cgi-bin/webscr"&gt;
  &lt;input type="submit" class="book_nowinp" value="book_now" name="btnBook"/&gt;
           &lt;/form&gt;
  </code></pre>