This form utilizes the standard PayPal format for making purchases.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="84fdebf1c4fdebf1f6e1e9e5ede8aae7ebe9">[email protected]</a>">
<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>
Instead of using this form, I prefer to accomplish the task using 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);
});
}
Encountering an error message:
XMLHttpRequest cannot load . The request was redirected to '', which is disallowed for cross-origin requests that require preflight.
Any ideas on how I can achieve the same outcome in angularJS without using the form?