Created
January 11, 2013 23:12
-
-
Save brianweiner/4514749 to your computer and use it in GitHub Desktop.
Stripe response handler with conditional assignment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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