I am getting a 404 : 'GET /undefined' error and can not figure out where it is coming from. Have minimum code in JS, HTML, PHP. See http://www.w3wa.com for info.
Javascript:
function getImage() {
var xhttp = new XMLHttpRequest;
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200 ) {
console.log(this.responseText);
document.getElementById('dot').src = this.responseText;
document.getElementById('dot').alt = 'three bar thingie';
document.getElementById('dot').style.width = '100px';
document.getElementById('dot').style.height = '100px';
}
}
xhttp.open("GET","Parse.php",true);
xhttp.send();
}
PHP:
<?php
/* Parse.php
Geesh, testing ONE item
*/
echo 'Images/3LineMenu.png';
?>
Surf to http://www.w3wa.com and view source if you wish to see html. Tested with Chrome and Firefox on Linux, Chrome on W10.
HTML:
<img id='dot' src='Images/1dot.png' style='width: 1px; height: 1px;' alt='one little dot'>
<script>document.getElementById('dot').src = getImage();</script>