Share this question

Welcome to Teachnovice Q&A, where you can ask questions and receive answers from other members of the community.

This is a collaboratively edited question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Cross domain request with xmlHttpRequest and Paypal?

0 like 0 dislike

I am trying to do a cross domain request with XMLHttpRequest object, because with $.ajax it doesn't work in IE, only in Chrome, Firefox and Safari. Below is a code sample

$("#btn").click(function () {

function CallWithXhr() {
    var xhr = new XMLHttpRequest();"POST", "", true);
    xhr.setRequestHeader('Content-Type', 'application/json');
    xhr.setRequestHeader("Access-Control-Allow-Origin", "*");
    xhr.onload = function () {
        var responseText = xhr.responseText;
    xhr.onerror = function () {
        console.log('There was an error!');

I need this call because I want to add a product to the Paypal Shopping Cart without redirecting to the Paypal Shopping Cart. I have made this thing with $.ajax but it didn't work in Internet Explorer 10 and 11.

The errors I get in IE are:

SEC7126: Redirects are not allowed for CORS preflight requests.
SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.

In Chrome I get only one error for this script:

XMLHttpRequest cannot load The request was redirected to '', which is disallowed for cross-origin requests that require preflight.

Any ideas about this issue? Thanks!

asked Jan 24, 2015 by Alex  

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.