Answer the question
In order to leave comments, you need to log in
How to pass data asynchronously with XMLHttpRequest?
How to pass value from XMLHttpRequest request to this.VideoUrl class variable when asynchronous ?
class Test{
constructor() {
this.VideoUrl = "";
this.url = "https"
}
getUrl(){
let xhr = new XMLHttpRequest();
xhr.open("GET", this.url, true);
xhr.send();
let transfer =(x)=>{
this.urlToVideo = x;
}
function handler() {
let VideoUrl = this.responseXML
transfer(VideoUrl);
}
xhr.onload = handler;
}
log(){
console.log(this.urlToVideo)
}
}
Answer the question
In order to leave comments, you need to log in
Quintis , Here, purely at random, you are trying to do something like this?
test.getUrl()
test.log()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question