user3458519
user3458519

Reputation: 13

cross domain request with ajax

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

Answers (1)

John Dalton
John Dalton

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

Related Questions