2021年3月24日星期三

can window.event share variables?

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)

https://stackoverflow.com/questions/66792483/can-window-event-share-variables March 25, 2021 at 11:06AM

没有评论:

发表评论