In the following code, I try to show stings of the source in a HTML table. The problem at this is, that instead of the string I see "undefined". Thanks in advance!
<!DOCTYPE html>
<html>
<body>
<h2>Table:</h2>
<p id="demo"></p>
<script>
var obj, dbParam, xmlhttp, myObj, x, txt = "";
obj = { table: "customers", limit: 20 };
dbParam = JSON.stringify(obj);
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
myObj = JSON.parse(this.responseText);
txt += "<table border='1'>"
for (x in myObj) {
txt += "<tr><td>" + myObj[x].name + "</td></tr>";
}
txt += "</table>"
document.getElementById("demo").innerHTML = txt;
}
};
xmlhttp.open("POST", "https://www.bayern-fahrplan.de/DDIP01?CoordSystem=WGS84&MinX=11%2C012742519378662&MinY=49%2C465725517007506&MaxX=11%2C035208702087402&MaxY=49%2C47637864525285&ts=154159795103", true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.send("x=" + dbParam);
</script>
</body>
</html>