Browse Source

added some structure in the search results with a table

master
T. Meissner 11 years ago
parent
commit
c1ded09db3
1 changed files with 23 additions and 3 deletions
  1. +23
    -3
      scripts/haltestellen.js

+ 23
- 3
scripts/haltestellen.js View File

@ -55,6 +55,9 @@ function ajaxCall(dataUrl, outputElement, callback) {
console.log("anonymous function"); console.log("anonymous function");
var wurst = [["13","Prohlis","754"],["13","Prohlis","754"],["13","Prohlis","754"],["13","Prohlis","754"]];
console.log(wurst.length);
// get the search form // get the search form
var searchForm = document.getElementById("search-form"); var searchForm = document.getElementById("search-form");
@ -75,9 +78,26 @@ function ajaxCall(dataUrl, outputElement, callback) {
ajaxCall(hstUrl, target, function(data) { ajaxCall(hstUrl, target, function(data) {
target.innerHTML = "";
target.innerHTML = "<p>" + data + "</p>";
var i;
var y;
var dataLength = data.length;
target.innerHTML = "<table>";
target.innerHTML += "<tr>";
target.innerHTML += "<th>Linie</th>";
target.innerHTML += "<th>Richtung</th>";
target.innerHTML += "<th>Abfahrt</th>";
target.innerHTML += "</tr>";
for (i = 0; i < dataLength; i++) {
target.innerHTML += "<tr>";
for (y = 0; y < 3; y++) {
target.innerHTML += "<td>" + data[i][y] + "</td>";
}
target.innerHTML += "</tr>";
}
target.innerHTML += "</table>";
}); });
} }
}; };


Loading…
Cancel
Save