title: Submit form values before paypal
body: <p>I'm trying to override the paypal submit form below to run some ajax before submitting but for some reason everything up till submitting the actual form is working.</p>
  
  <p><strong>Paypal Form</strong></p>
  
  <pre><code>&lt;form name="_xclick" id="payWithPaypal" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"&gt;
      &lt;input type="hidden" name="cmd" value="_xclick"&gt;
      &lt;input type="hidden" name="business" value="email@website.com"&gt;
      &lt;input type="hidden" name="currency_code" value="USD"&gt;
      &lt;input type="hidden" name="item_name" value="Item Name Here"&gt;
      &lt;input type="hidden" name="amount" value="12"&gt;
      &lt;input type="hidden" name="return" value="http://www.website.com"&gt;
      &lt;input type="hidden" name="notify_url" value="http://www.website.com/ipn.php"&gt;
      &lt;input type="submit" id="submitPaypal" class="mailsubmit" value="Pay Now" border="0" name="submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>Overriding the submit button</strong></p>
  
  <pre><code>&lt;script&gt;
      $(function(){
          $('#submitPaypal').on("click", function(e){
              event.preventDefault();
              tailor();
          });
      });
  &lt;/script&gt;  
  </code></pre>
  
  <p><strong>Ajax that should run then submit the above form</strong></p>
  
  <pre><code>   &lt;script type="text/javascript"&gt;
          function tailor(){
               $.ajax({
                  url: "info.php",
                  type: "POST",
                  data: {NAME:"test"},
                  success: function(data){
                       $('#payWithPaypal').submit();
                  }
             });
          }
      &lt;/script&gt;
  </code></pre>
  
  <p>Any insight as to why <code>$('#payWithPaypal').submit();</code> isn't working would be greatly appreciated</p>