title: credit card form submission on a bootstrap modal
body: <p>I created bootstrap modal for my credit card payment form i want validate the credit card form now am using basic validation in jquery.</p>
  
  <pre><code>&lt;script&gt;
  $(function() {
  $('#error_message_reg').text("");
  //$( "submitBtnRegister" ).click(function() {
  $('#register_form').on('submit', function()  {
   //e.preventDefault();
  var error=false; 
  var firstName = $('#payment_first_name').val();
  var lastName = $('#payment_last_name').val();
  var adress = $('#payment_address').val();
  var city = $('#payment_city').val();
  var state = $('#payment_state').val();
  var zip = $('#payment_zip').val();
  var country = $('#payment_country').val();
  var cc_no = $('#payment_card_no').val();
  var cc_month = $('#payment_card_expiry_month').val();
  var cc_year = $('#payment_card_expiry_year').val();
  var cc_ccv = $('#payment_card_ccv').val();
  var postal_code = $('#payment_card_postal_code').val();
  
  
  
  
  
  
  if(firstName == null || firstName == "") {
              $('#error_message_reg').text("FIrst name is required");
              var error=true;
              return false;
          }
  
  
  
  if(lastName == null || lastName == "") {
              $('#error_message_reg').text("Last name is required.");
              var error=true;
              return false;
          }
  if(adress == null || adress == "") {
              $('#error_message_reg').text("Adress is required.");
              var error=true;
              return false;
          }
  if(city == null || city == "") {
              $('#error_message_reg').text("City is required.");
              var error=true;
              return false;
          }
  if(state == null || state == "") {
              $('#error_message_reg').text("state is required.");
              var error=true;
              return false;
          }
  if(zip == null || zip == "") {
              $('#error_message_reg').text("Zip is required.");
              var error=true;
              return false;
          }
  if(country == null || country == "") {
              $('#error_message_reg').text("country is required.");
              var error=true;
              return false;
          }
  if(cc_no == null || cc_no == "") {
              $('#error_message_reg').text("Card number is required.");
              var error=true;
              return false;
          }
  if(cc_month == null || cc_month == "") {
              $('#error_message_reg').text("expiry month is required.");
              var error=true;
              return false;
          }
  if(cc_year == null || cc_year == "") {
              $('#error_message_reg').text("expiry year is required.");
              var error=true;
              return false;
          }
  if(cc_ccv == null || cc_ccv == "") {
              $('#error_message_reg').text("CVV is required.");
              var error=true;
              return false;
          }
  if(postal_code == null || postal_code == "") {
              $('#error_message_reg').text("postal code is required.");
              var error=true;
              return false;
          }
  if(error==false)
  {
          $('#error_message_reg').text("");
          $('#register_form').submit();
  
  }
  });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>I would like to add credit card validation also like is this card is valid.
  i use braintree as my payment gateway i can check valid transaction using <code>$result-&gt;errors-&gt;deepAll()</code><br>
  but when i submit the form the modal getting closed.Is there any way to prevent closing the modal until the response from braintree comes.
  Is it possible to do this without using a ajax.</p>
  
  <p>Thank in advance</p>