JSFiddle - React, Tailwind, and code Playground
HTML
survivors online: <span id="online"></span>
JavaScript
$( document ).ready(function() {
getServerInfo();
$('.customNav').prependTo($('body'));
});
function getServerInfo() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (xhttp.readyState == 4 && xhttp.status == 200) {
fetchXML(xhttp);
}
};
xhttp.open("GET", "http://www.gametracker.com/datafeeds/?server_info&GAMESERVERID=4578855", true);
xhttp.send();
}
function fetchXML(xml) {
var i;
var xmlDoc = xml.responseXML;
var table="";
var x = xmlDoc.getElementsByTagName("server");
for (i = 0; i <x.length; i++) {
table += "" +
x[i].getElementsByTagName("playerscurrent")[0].childNodes[0].nodeValue;
}
document.getElementById("online").innerHTML = table;
console.log(table);
}