angular7 - 根据请求,braintree-web API 中位置 1 处 JSON 中的意外令牌 o
问题描述
我已将 Braintree 集成到我的 Angular 7 应用程序中。但我有一个错误。到目前为止我已经搜索但无法获得解决方案。
错误::
zone.js:199 Uncaught SyntaxError: Unexpected token o in JSON at position 1
at JSON.parse (<anonymous>)
at wk (fb.js:1)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)
at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:498)
at invokeTask (zone.js:1744)
at globalZoneAwareCallback
index.html::
<script src="https://js.braintreegateway.com/web/3.46.0/js/client.min.js"></script>
App.component.ts::
declare var braintree:any;
export class AppComponent implements OnInit {
ngOnInit(){
braintree.client.create({
authorization: 'token'
}, function (createErr, clientInstance) {
clientInstance.request({
endpoint: 'payment_methods/credit_cards',
method: 'POST',
data: {
creditCard: {
number: '4111111111111111',
cvv: '123',
expirationDate: '12/23'
}
}
}, function (requestErr, response) {
console.log(response)
});
});
}
}
参考链接::braintree-web
请告诉我,如何解决这个问题。
解决方案
推荐阅读
- python - 当我指定相同的宽度时,为什么我的水平条形图中的条具有不同的宽度?
- combinations - 有大小限制的项目组合
- python - 为什么 time.sleep(...) 不受 GIL 影响?
- image - 在 Laravel 中处理来自 Dropzone 的文件块
- angular - 带有 apollo-angular 客户端的 Aws-appsync 订阅
- svm - 文档长度可以用作分类的特征吗?
- ruby - 在 Ruby 中救援后仅运行特定代码块
- python - 熊猫 - 将每个单元格除以列总和 - 但它返回相同的值
- javascript - 我无法从 JSON 响应中访问密钥,但可以查看其所有密钥
- c - 如何在C中获取数组中的值?