this.reqURL = './appData/data.json';
this.req = new XMLHttpRequest();
this.req.open('get',this.reqURL);
this.req.responseType = 'json';
this.req.send();
this.resp = null;
this.req.onload = () => {
this.resp = this.req.response;
}
console.log(this.resp);
null
I tried to make this.resp
to be this.req.response
However, it keeps returns null
which is default value of it.
I want this.resp
to be this.req.response
can I?
(Sorry for my bad english)