将 Braintree 与 js 一起使用,但出现以下错误
Uncaught Error: Could not stringify event: JSON.stringify is not a function
我在表单中添加了 div(jsp 页面)
<div id="paypal-container"> <input type="submit" name="btnSub" value="Pay" id="btnSub"/> </div>
并在 js 调用 ajax 以从 api 接收客户端令牌和
braintree.setup(""+clientToken+"", "dropin", {
id: 'paypal-container',
paypal: {
container: "paypal-container",
onSuccess: function (nonce, email) {
console.log("email"+nonce+"\t "+email);
}
},
hostedFields: {
number: {
selector: "**** **** 1111 1111"
},
cvv: {
selector: "***"
},
expirationMonth: {
selector: "12"
},
expirationYear: {
selector: "2018"
}
},
onPaymentMethodReceived: function (obj) {
console.log(obj);
alert('onPaymentMethodReceived');
},
onError :function(obj){
alert('onError');
}
});
我在 jquery 加载时运行它,但遇到异常请帮忙。