function loadText() {
var xhttp;
if (window.XMLHttpRequest) {
xhttp = new XMLHttpRequest();
} else {
xhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var img = new Image();
img.src = "car.png";
document.querySelector(".div").appendChild(document.createElement("img"));
}
}
xhttp.open("GET", "car.png", true);
xhttp.send();
}
var img = new Image();
img.src = "car.png";
document.querySelector(".div").appendChild(img);