Reputation: 13
I am trying to redirect from my local domain to Paypal checkout domain using ajax request.I am also allowing cross domain to true.but I am getting the error that
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.
my code is :
$.ajax({
type: 'GET',
url: url,
processData: false,
crossDomain: true,
contentType: "application/json",
jsonp: false,
success: function() {
alert("Success");
},
error: function() {
alert("failure");
}
});
Upvotes: 0
Views: 365
Reputation: 150
In order for a CORS request to be allowed, the SERVER side needs to populate the Access-Control-Allow-Origin
Header in the response. I would presume that the Paypal servers do not do this and so this is why you are receiving the error.
For more information, see this link: https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS
Upvotes: 1