0
我已经创建了条纹的支付形式,需要为了得到令牌可以提交自己的状态之前,他们的API进行交互。所有事情都经过了Chrome的测试和工作,但昨天一位用户表示它不适用于Safari。上beforeSubmit jQuery的不叫在Safari
我已经能够缩小事业的Safari浏览器下面的代码之前提交表单执行:
$('#payment-form').on('beforeSubmit', function(event) {
if (isCcNeeded()) {
// Disable the submit button to prevent repeated clicks:
$('#payment-form').find('.submit').prop('disabled', true);
// Request a token from Stripe:
Stripe.card.createToken({
number: $('input#stripe-card-number').val(),
cvc: $('input#stripe-cvc').val(),
exp_month: getExpMonth(),
exp_year: getExpYear(),
address_zip: $('input#stripe-address-zip').val()
}, stripeResponseHandler);
// Prevent the form from being submitted:
return false;
}
});
有谁知道它为什么跳过此?
你可以更改beforeSubmit提交和测试? – gaetanoM
你为什么在提交之前打电话?只需使用上提交和发布形式在stripeResponseHandler如果createToken呼叫全成 –
@gaetanoM,我已经通过更换 $尝试它,以及(“#付款形式”)。在(“beforeSubmit”,函数(事件) 与 $( '#付款形式')。提交(函数(事件) 也 $( '#付款形式')。在( '提交',函数(事件) 都具有相同的 – Fittersman