Skip to content

Instantly share code, notes, and snippets.

@brianweiner
Created January 11, 2013 23:12
Show Gist options
  • Save brianweiner/4514749 to your computer and use it in GitHub Desktop.
Save brianweiner/4514749 to your computer and use it in GitHub Desktop.
Stripe response handler with conditional assignment
$(document).ready(function() {
$("#payment-form").submit(function(event) {
// disable the submit button to prevent repeated clicks
$('.submit-button').attr("disabled", "disabled");
Stripe.createToken({
number: $('.card-number').val(),
cvc: $('.card-cvc').val(),
exp_month: $('.card-expiry-month').val() || "0",
exp_year: $('.card-expiry-year').val() || "0"
}, stripeResponseHandler);
// prevent the form from submitting with the default action
return false;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment