0

I have this function call which I need to convert to POST request because this is getting popped up in query parameter in SSL security threat. Could you please help ? Thanks

 LoadYearMakeModelUsingAutoVin(controlId, 'RequestXml.aspx?name=GetVehicleInfoUsingVinCanada&VinOrSerialNumber=' + vinOrserialnumber);

 ------------------------------------
 function LoadYearMakeModelUsingAutoVin(controlItem, dataSourceUrl) {
    var xmlDoc;
    var xmlDoc2;
    if (window.ActiveXObject) {
        var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        xmlHttp.open("POST", dataSourceUrl, false);

        xmlHttp.send(null);
        xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
        xmlDoc.async = false;
        xmlDoc = xmlHttp.responseXML;
        var nodes = xmlDoc.getElementsByTagName("LookupData");
        if (nodes.length > 0) {
            var node = nodes.item(0);
            if (node.childNodes.item(0).text != null) {
                if (node.childNodes.item(0).text.split("`").length == "9") {
                    FillAutoInfoValuesCanada(node, controlItem);
                }
                else {
                    BlankAutoInfoValues(controlItem); //Defect 57092
                }
            }
        }
        else {
            BlankAutoInfoValues(controlItem);
        }
    }
    else if (window.XMLHttpRequest) {
        var xmlHttp2 = new XMLHttpRequest();
        xmlHttp2.open("GET", dataSourceUrl, false);
        xmlHttp2.send(null);
        xmlDoc2 = xmlHttp2.responseXML;
        var nodes = xmlDoc2.getElementsByTagName("LookupData");
        if (nodes.length > 0) {
            var node = nodes.item(0);
            if (node.childNodes.item(0).text != null) {
                if (node.childNodes.item(0).text.split("`").length == "6") {
                    FillAutoInfoValuesCanada(node, controlItem);
                }
                else {
                    BlankAutoInfoValues(controlItem);
                }
            }
        }
    }
    else {
        alert('Your browser does not support some functionality required by this page. To continue please upgrade to the latest release of your browser software.');
        return;
    }
}
2
Contributors
3
Replies
35
Views
1 Year
Discussion Span
Last Post by AleMonteiro
1

You can just take apart the URL page and the params, like this:

function LoadYearMakeModelUsingAutoVin(controlItem, dataSourceUrl, postParams) {
    ...

    var xmlHttp2 = new XMLHttpRequest();
    xmlHttp2.open("POST", dataSourceUrl, false);

    //Set proper header data
    http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    http.setRequestHeader("Content-length", postParams.length);
    http.setRequestHeader("Connection", "close");

    xmlHttp2.send(postParams);

    ...

}

//And use it like
LoadYearMakeModelUsingAutoVin(controlId, 'RequestXml.aspx', 'name=GetVehicleInfoUsingVinCanada&VinOrSerialNumber=' + vinOrserialnumber);

Or you could use FormData also:
https://developer.mozilla.org/en-US/docs/Web/API/FormData/Using_FormData_Objects

0

You're welcome.
Just mark the thread as solved please. You can create a new one if you need futher assistence.

Cheers!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.