I am trying to load data from grafana using Javascript XMLHTTPRequest. Following is my code,
function populateIframe( ) {
var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://username:password@localhost:3000/api/org');
xhr.onreadystatechange = handler;
xhr.send();
function handler() {
debugger;
if (this.readyState === this.DONE) {
if (this.status === 200) {
// this.response is a Blob, because we set responseType above
document.getElementById("iframe").src = URL.createObjectURL(this.response);
} else {
console.error('XHR failed', this);
}
}
}
I am getting status code as 0. And i also tried Ajax call to get Grafana response, But still am not getting any proper data. Can someone guide me to solve this.
Thanks in advance.