Javascript 带angularjs$http.post请求的Paypal
这是买东西的标准贝宝表单Javascript 带angularjs$http.post请求的Paypal,javascript,angularjs,paypal,angular-http,Javascript,Angularjs,Paypal,Angular Http,这是买东西的标准贝宝表单 <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="you@youremail.com"> <input type="hidden" name="item_nam
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="you@youremail.com">
<input type="hidden" name="item_name" value="Item Name">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="amount" value="0.00">
<input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-but01.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
我不想要这个表格,我想用angularJS做这个:
<button ng-click="checkOut()" class="btn btn-default">Buy</button>
this.checkOut = function () {
var data = {
... // handle all data
};
$http.post('https://www.paypal.com/cgi-bin/webscr', data).success(function (data) {
console.log("success " + data);
}).error(function (data) {
console.log("error " + data);
});
}
购买
this.checkOut=函数(){
风险值数据={
…//处理所有数据
};
$http.post('https://www.paypal.com/cgi-bin/webscr,数据)。成功(函数(数据){
console.log(“成功”+数据);
}).错误(函数(数据){
控制台日志(“错误”+数据);
});
}
这给了我一个错误:
无法加载XMLHttpRequest。这个
请求已重定向到“”,这是
不允许用于需要飞行前的跨来源请求
有什么建议,怎么做angularJS,没有表单吗?PayPal现在不支持,所以不可能使用
$http
发布到PayPal如果你想使用PayPal的服务,你需要使用他们的API,而不仅仅是复制他们的代码并期望它以同样的方式工作。你想做什么?