Error in XmlHttpRequest in IE10

0

I have a web page developed on asp.net, which makes requests by javascript to an NVR team by means of xmlhttprequest and urls to make such requests, all requests are made by GET and with access credentials to the team, when I do the tests and under the version of the browser to 9 works as it should, but if I do with more recent versions of the browser, when doing the open, I mark an error of invalidaccesserror, this page will only work in internet explorer and the function that I have defined for the requests is the following:

function SendRequest(url, method, callback, account, password) {
var http_request = new XMLHttpRequest();
if (http_request) {
    http_request.onreadystatechange = func;

    try {
        if (account && password)
            http_request.open(method, url, true, account, password);
        else
            http_request.open(method, url, true);

        http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        http_request.setRequestHeader("Cache-Control", "no-cache");
        http_request.setRequestHeader("Pragma", "no-cache");
        http_request.setRequestHeader("Accept", "*/*");
        http_request.responseType = "msxml-document";
        http_request.send(null);
    }
    catch (e) {
        http_request = null;
        window.setTimeout(function () {
            if (callback)
                callback(0, null);
        }, 1);
    }
}

function func() {
    if (http_request.readyState == 4) {
        if (callback)
            callback(http_request.status, http_request.responseText);
    }
}

}

Is there any configuration that I'm missing?

Greetings

I made some corrections to the call and that way the team could already solve me, but now I have the inconvenience that when the request is made it ignores the credentials and asks me to provide the username and password I already sent

function SendRequestJquery(url, method, callback, account, password) {
$.ajax({
    url: url,
    method: "GET",
    dataType: "jsonp",
    username: account,
    password: password,
    beforeSend: function (xhrBS) {
        xhrBS.withCredentials = true;
        xhrBS.responseType = "msxml-document";
    },
    crossDomain: true,
    success: function (data) {
        if (callback)
            callback();
    },
    error: function (xhr, ajaxOptions, thrownError) {
        alert(xhr.status);
        alert(xhr.responseText);
    }
});    

}

    
asked by elchente23 24.03.2016 в 20:08
source

0 answers