var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function () { if (xhr.readyState == 4 && xhr.status == 200) { console.log(xhr.responseText); } }; xhr.open('post', gDatagridUrl, true); xhr.setRequestHeader("Authorization", sessionStorage.getItem("token")); xhr.setRequestHeader("Content-Type", "application/json"); xhr.setRequestHeader("Accept", "application/json"); // xhr.onload = function () { // if (this.status == 200) { // var res = this.response; // console.log(res) // } // }; xhr.send();