Discussions

Problem with XmlHttpRequest Javascript

  • 1.  Problem with XmlHttpRequest Javascript

    Posted 07-14-2018 10:02
    this script logs 'null' for the xml object, I know I should use jQuery, but I would like to use an XHR object on this occasion, since I am working with another company's API as well and it would be really nice to know how to use XHR with quickbase

    function procVehicleXml(){
    var xml;
    var request = new XMLHttpRequest();
    request.open("POST", rprUrl, true);
    request.onreadystatechange = function(){
    if (this.readyState === 4 && this.status === 200){
    xml = this.responseXML;
    console.dirxml(xml);
    }
    };
    var apiMethod = {
    apptoken: token,
    action: "API_DoQuery",
    clist: "35"
    };
    request.send(JSON.stringify(apiMethod));
    }