function httpGet(theUrl) { var xmlHttp = null; xmlHttp = new XMLHttpRequest(); xmlHttp.open("POST", theUrl, false); xmlHttp.setRequestHeader("username", "invalid"); xmlHttp.setRequestHeader("password", "invalid;); xmlHttp.setRequestHeader("Content-Type", "application/json"); xmlHttp.setRequestHeader("Accept", "application/json"); xmlHttp.setRequestHeader("Accept-Encoding", "gzip,deflate"); xmlHttp.send(); alert(xmlHttp.readyState); // here I am getting 4 alert(xmlHttp.status); // here I am getting 200 alert(xmlHttp.responseText); // but here it is blank // xmlHttp.responseType = "json"; if (xmlHttp.readyState == 4 && xmlHttp.status == 200) { alert(xmlHttp.responseText); // here also it is blank } else { alert("fail to get status"); } return xmlHttp.responseText; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)