基于ajax的跨域请求

基于ajax的跨域请求,ajax,paypal,cors,Ajax,Paypal,Cors,我正在尝试使用ajax请求从本地域重定向到Paypal签出域。我还允许跨域设置为true。但我得到的错误是 No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access. 我的代码是: $.ajax({ type: 'GET',

我正在尝试使用ajax请求从本地域重定向到Paypal签出域。我还允许跨域设置为true。但我得到的错误是

  No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin      'http://localhost' is therefore not allowed access. 
我的代码是:

$.ajax({
            type: 'GET',
            url: url,
            processData: false,
            crossDomain: true,
            contentType: "application/json",
            jsonp: false,
            success: function() {
                alert("Success");
            },
            error: function() {
                alert("failure");
            }
    });

为了允许CORS请求,服务器端需要在响应中填充
Access Control Allow Origin
头。我假设Paypal服务器不这样做,因此这就是您收到错误的原因

有关更多信息,请参阅此链接: