I'm trying to add an id variable (in this case, demo) to the end of the link but I can't make it work, how can I do it?
var request = new XMLHttpRequest()
request.open('GET', 'https://discordapp.com/api/users/412315079598407691', true)
request.setRequestHeader("Authorization", "Bot bot-token")
request.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var myObj = JSON.parse(this.responseText);
document.getElementById("demo").innerHTML = myObj.avatar;
}
};
request.send()
function myFunction() {
var x = document.createElement("IMG");
x.setAttribute("src", `https://cdn.discordapp.com/avatars/412315079598407691/`+ demo);
x.setAttribute("width", "350");
document.body.appendChild(x);
}