javascript - How to resubmit form? -


i want when resubmit form goes next page.

but, when trying resubmit form recursively called '$('#payment-form').submit(function(e){}' function , program goes in infinite loop. try, $form.get(0).submit();

i don't know code not working.

what change can code work properly.please suggest me find out solution.

code:

<script type="text/javascript">     // identifies website in createtoken call below     stripe.setpublishablekey('pk_test_jvzbqne7ydpeizomqo0d9mar');      var striperesponsehandler = function( status , response) {         var $form = $('#payment-form');          if (response.error) {             // show errors on form             alert("error...!");             var error = " error : "+response.error.message;             $form.find('.payment-errors').text(error);             $form.find('button').prop('disabled', false);             return false;         }          else          {             alert(" card submited..");             var token = response.id;             $form.find('.payment-errors').text('your card submited..! :: ' + token);             document.getelementbyid("stripetoken").value = token;              // , re-submit            $form.submit();          }     };      jquery(function($) {         $('#payment-form').submit(function(e){         //function submitcard() {         var $form = $('#payment-form');          var number = $('.card-number').val();         var  cvc = $('.card-cvc').val();         var  exp_month = $('.card-expiry-month').val();         var exp_year = $('.card-expiry-year').val();         //var email =$('.card-email').val();         //var amount =$('.card-amount').val();          if (!stripe.validatecardnumber(number)) {             alert('the credit card number appears invalid.');             return false;         }          // validate cvc:         if (!stripe.validatecvc(cvc)) {             alert('the cvc number appears invalid.');             return false;         }          // validate expiration:          if (!stripe.validateexpiry(exp_month, exp_year)) {              alert('the expiration date appears invalid.');              return false;          }           //  disable submit button prevent repeated clicks          $form.find('#submit').prop('disabled', true);           stripe.card.createtoken({              number: $('.card-number').val(),              cvc: $('.card-cvc').val(),              exp_month: $('.card-expiry-month').val(),              exp_year: $('.card-expiry-year').val()          }, striperesponsehandler);           //stripe.card.createtoken($form, striperesponsehandler);           // prevent form submitting default action          return false;         });     }); </script> 


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -