From c1ded09db3b60c7e81995a03ab32fa15759a5de0 Mon Sep 17 00:00:00 2001 From: tmeissner Date: Mon, 25 Feb 2013 15:49:58 +0100 Subject: [PATCH] added some structure in the search results with a table --- scripts/haltestellen.js | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/scripts/haltestellen.js b/scripts/haltestellen.js index cd979e8..e2b1a45 100644 --- a/scripts/haltestellen.js +++ b/scripts/haltestellen.js @@ -55,6 +55,9 @@ function ajaxCall(dataUrl, outputElement, callback) { 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 var searchForm = document.getElementById("search-form"); @@ -75,9 +78,26 @@ function ajaxCall(dataUrl, outputElement, callback) { ajaxCall(hstUrl, target, function(data) { - target.innerHTML = ""; - - target.innerHTML = "

" + data + "

"; + var i; + var y; + var dataLength = data.length; + + target.innerHTML = ""; + target.innerHTML += ""; + target.innerHTML += ""; + target.innerHTML += ""; + target.innerHTML += ""; + target.innerHTML += ""; + + for (i = 0; i < dataLength; i++) { + target.innerHTML += ""; + for (y = 0; y < 3; y++) { + target.innerHTML += ""; + } + target.innerHTML += ""; + } + + target.innerHTML += "
LinieRichtungAbfahrt
" + data[i][y] + "
"; }); } };