I've encountered an issue with my code where the form submission doesn't work properly unless I wait a few milliseconds before submitting. The problem seems to be related to setting the value of a hidden field called paymentToken.
My goal is to have the form submit automatically once the paymentToken value is set.
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(); // The form is submitted, but the paymentToken is not set yet.
});
}
});