我有以下代码:
order =
setupForm: ->
$('.new_order').submit ->
$form = $(this)
$form.find('input[type=submit]').attr('disabled', true)
order.processCard($form)
false
processCard: ($form)->
card =
number: $form.find('.card_number').val()
cvc: $form.find('.card_code').val()
expMonth: $form.find('.card_month').val()
expYear: $form.find('.card_year').val()
Stripe.createToken card, (status, response) ->
order.handleStripeResponse(status, response, $form)
handleStripeResponse: (status, response, $form) ->
if status == 200
$form.find('.order_stripe_card_token').val(response.id)
$form.submit()
else
$form.find('.stripe_error').text(response.error.message)
$form.find('input[type=submit]').attr('disabled', false)
它使得错误完全确定(如果卡号是错/丢失等),但是当我把在由条纹提供了正确的卡的详细信息,它不提交任何东西。
我敢肯定这件事情很明显我丢失,但需要一些新鲜的眼光指出哪里有错误所在。