diff --git a/js/pis.js b/js/pis.js index dd7ffca..c539fdb 100644 --- a/js/pis.js +++ b/js/pis.js @@ -27,21 +27,24 @@ async function insertData(json) { // PIS codes. Display the code and the stops with a method of scrolling between them. // Maybe as a table or a carousel? const div = document.getElementById('result-box') - const tableHtml = ` + let tableData = `
- -
Code Stations
` + ` div.insertAdjacentHTML("beforeend", tableHtml) const table = document.getElementById('result-table') const data = JSON.parse(json) + let results = 0 for(var i = 0; i < data.length; i++) { // Break into separate function. Need to // iterate over stops. - let row = `${data[i][code]} + tableData += `${data[i][code]} ${data[i][stops]}` - table.insertAdjacentHTML("beforeend", row) + results++ } + tableData += "" + table.insertAdjacentHTML("beforeend", tableData) + document.getElementById('result-count').textContent = results } async function noData() { diff --git a/pis.html b/pis.html index 2af8dbd..0b04c0b 100644 --- a/pis.html +++ b/pis.html @@ -55,7 +55,7 @@
-

Results

+

Results: 0