0
我有以下代碼,其中提交表單後響應設置爲隱藏字段。問題是,如果我不等幾分鐘或幾秒鐘,那麼它就不會保存它,如果我稍等一會然後提交表單,那麼它工作正常。
我基本上想要提交表單,只要值設置爲paymentToken(隱藏字段)。
braintree.setup($scope.serverToken, "dropin", {
container: "dropin-container",
onPaymentMethodReceived: function (response)
{
$scope.paymentToken = 'testing';
$scope.$apply(function() {
$scope.paymentToken = response.nonce;
console.log($scope.paymentToken);
document.getElementById("myForm").submit(); // form is submitted, but no paymentToken is not set yet.
});
}
});