javascript - Multiple Stripe payment forms on single page -


i trying token stripe account. working fine if there 1 form not on multiple. want token form submited user purpose sending ajax request stripe giving seperate id every form. showing type error b not defined. want know weather there syntax error or not. if not why not working.

 <form id="stripe_form-1" role="form" method="post" action="#">   <div id="#payment-errors-1"></div> <input type="text" name="cc_number" value=""> <input type="text" name="cvv" value=""> <input type="text" name="ex_month" value=""> <input type="text" name="ex_year" value=""> <button id="sbtn-1 type=""button" onclick="stripefunction1()" </button> </form>  <form id="stripe_form-2" role="form" method="post" action="#">   <div id="#payment-errors-2"></div> <input type="text" name="cc_number" value=""> <input type="text" name="cvv" value=""> <input type="text" name="ex_month" value=""> <input type="text" name="ex_year" value=""> <button id="sbtn-2" type=""button" onclick="stripefunction2()" </button> </form>  <form id="stripe_form-3" role="form" method="post" action="#">   <div id="#payment-errors-3"></div> <input type="text" name="cc_number" value=""> <input type="text" name="cvv" value=""> <input type="text" name="ex_month" value=""> <input type="text" name="ex_year" value=""> <button id="sbtn-3" type=""button" onclick="stripefunction2()" </button> </form> 

in java script

function stripefunction1() {     var form = $('#stripe_form-1'); form.find('#sbtn-1').prop('disabled', true); stripe.createtoken(form, striperesponsehandler_1); } var striperesponsehandler_1 = function(status, response) { var form = $('#stripe_form-1'); if (response.error) {     form.find('#payment-errors-1').text(response.error.message);     form.find('#sbtn-1').prop('disabled', false); } else {     $('<input>', {         'type': 'hidden',         'name': 'stripetoken',         'value': response.id     }).appendto(form);     form.get(0).submit(); } };  function stripefunction2() {     var form = $('#stripe_form-2'); form.find('#sbtn-2').prop('disabled', true); stripe.createtoken(form, striperesponsehandler_2); } var striperesponsehandler_2 = function(status, response) { var form = $('#stripe_form-2'); if (response.error) {     form.find('#payment-errors-2').text(response.error.message);     form.find('#sbtn-2').prop('disabled', false); } else {     $('<input>', {         'type': 'hidden',         'name': 'stripetoken',         'value': response.id     }).appendto(form);     form.get(0).submit(); } }; function stripefunction3() {     var form = $('#stripe_form-3'); form.find('#sbtn-3').prop('disabled', true); stripe.createtoken(form, striperesponsehandler_3); } var striperesponsehandler_3 = function(status, response) { var form = $('#stripe_form-3'); if (response.error) {     form.find('#payment-errors-3').text(response.error.message);     form.find('#sbtn-3').prop('disabled', false); } else {     $('<input>', {         'type': 'hidden',         'name': 'stripetoken',         'value': response.id     }).appendto(form);     form.get(0).submit(); } }; 

when submit form give typeerror b not defined. there mistake in syntax or there other method?


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -