Getting CORS error posting to server (revised)

I was able to solve it with this:

let xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
        if (this.readyState == 4 && this.status == 200) {
            console.log(this.response);
            } 
        }
xhttp.open(POST, http://xxx.xxx.xxx:5005/model/parse);
http.setRequestHeader(Content-Type, application/json);
xhttp.send(JSON.stringify({text:msg}));