Browse Source

fixed bug in outer foor loop: data was overwritten every loop cycle, so the second cycle there was an runtime error

master
T. Meissner 12 years ago
parent
commit
03dfe29550
1 changed files with 6 additions and 4 deletions
  1. +6
    -4
      scripts/haltestellen.js

+ 6
- 4
scripts/haltestellen.js View File

@ -61,6 +61,7 @@ function ajaxCall(dataUrl, outputElement, callback) {
// haltestelle object // haltestelle object
var haltestelle = { var haltestelle = {
getInfo : function(event) { getInfo : function(event) {
console.log("getInfo function"); console.log("getInfo function");
@ -79,6 +80,7 @@ function ajaxCall(dataUrl, outputElement, callback) {
data = data.replace(/\],\[/gi, '#'); data = data.replace(/\],\[/gi, '#');
data = data.replace(/\(.+?\)/gi, ''); data = data.replace(/\(.+?\)/gi, '');
data = data.replace('ß', 'ss');
data = data.slice(2,-2).split("#"); data = data.slice(2,-2).split("#");
console.log("parsed data: " + data); console.log("parsed data: " + data);
@ -99,11 +101,11 @@ function ajaxCall(dataUrl, outputElement, callback) {
// generate table entries // generate table entries
for (i = 0; i < dataLength; i++) { for (i = 0; i < dataLength; i++) {
htmlOutput += "<tr>"; htmlOutput += "<tr>";
data = data[i].split(",");
console.log("part " + i + " of parsed data: " + data);
var entry = data[i].split(",");
console.log("part " + i + " of parsed data: " + entry);
for (y = 0; y < 3; y++) { for (y = 0; y < 3; y++) {
console.log("part " + y + ": " + data[y]);
htmlOutput += "<td>" + data[y].slice(1,-1) + "</td>";
console.log("part " + y + ": " + entry[y]);
htmlOutput += "<td>" + entry[y].slice(1,-1) + "</td>";
} }
htmlOutput += "</tr>"; htmlOutput += "</tr>";
} }


Loading…
Cancel
Save