[EdLUG] Help (Again ...)
Andrew Ramage
andrew.ramage.1963 at gmail.com
Fri May 22 17:52:42 UTC 2020
Trying to start a conversation on Reddit my posts are refused. So I will
have to ask here again.
I have my website up and (mostly) correct. I just need to get the
Directory to function correctly.
andrewnramage.co.uk
Copying and altering code from w3schools, I have this function. Why
will it not work?
<script>
// xhttp.onreadystatechange = function() {
// if (this.readyState == 4 && this.status == 200) {
myFunction(this);
// }
};
xhttp.open("GET", "directory.xml", true);
xhttp.send();
}
function dirmusic() {
var xhttp = new XMLHttpRequest();
xhttp.open("GET", "directory.xml", true);
xhttp.send();
var i;
var xmlDoc = xml.responseXML;
var xmlhttp = new XMLHttpRequest();
var table="";
var x = xmlDoc.getElementsByTagName("SONG");
for (i = 0; i <x.length; i++) {
table += "<a download='" .
x[i].getElementsByTagName("SONG")[0].childNodes[0].nodeValue> . "'" .
x[i].getElementsByTagName("SONG")[0].childNodes[0].nodeValue> . "</a><BR>";
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("dir").innerHTML = this.responseText;
} }
document.getElementById("dir").innerHTML = table;
}
</script>
<button margin-bottom=400px onclick=directory.php>Refresh</button>
<br>
<div id="dir">Directory goes here</div>
<script>
musicdir();
</script>
More information about the EdLUG
mailing list