diff --git a/scripts/haltestellen.js b/scripts/haltestellen.js index 1ac94da..dcf2e47 100644 --- a/scripts/haltestellen.js +++ b/scripts/haltestellen.js @@ -78,8 +78,8 @@ function ajaxCall(dataUrl, outputElement, callback) { console.log("received data: " + data); data = data.replace(/\],\[/gi, '#'); - data = data.slice(2,-2); - data = data.split("#"); + data = data.replace(/\(.+\),\[/gi, '#'); + data = data.slice(2,-2).split("#"); console.log("parsed data: " + data); @@ -88,6 +88,7 @@ function ajaxCall(dataUrl, outputElement, callback) { var htmlOutput; var dataLength = data.length; + // generate table header htmlOutput = "
Linie | "; @@ -95,17 +96,19 @@ function ajaxCall(dataUrl, outputElement, callback) { htmlOutput += "Abfahrt | "; htmlOutput += "
---|---|
" + trala[y].slice(1,-1) + " | "; + console.log("part " + y + ": " + data[y]); + htmlOutput += "" + data[y].slice(1,-1) + " | "; } htmlOutput += "