【发布时间】:2016-08-18 02:54:00
【问题描述】:
我正在尝试学习贝宝付款。我已经完成了一个使用 Paypal-Express-Checkout 的简单 AngularJS 应用程序。正如文档中所说,首先我必须调用 SetExpressCheckout。
$http.post("https://api-3t.sandbox.paypal.com/nvp", request)
.success(function(data){
console.log(data);
}).error(function(error){
console.log(error);
});
在request 对象中包含所有付款详情。
但是当我运行脚本时,http调用的结果是:XMLHttpRequest cannot load https://api-3t.sandbox.paypal.com/nvp. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access.
我试图搜索这个错误,但我什么也没找到。我该如何解决?
更新:如果请求来自表单不会给我任何错误,但如果它来自 http.post 函数它会给我一个错误
【问题讨论】:
标签: javascript angularjs http paypal