pis #1
@ -33,9 +33,7 @@ async function insertData(json) {
|
||||
<th class="stops">Stations</th>
|
||||
</tr>`
|
||||
let results = 0
|
||||
for(var i = 0; i < json.length; i++) { // Break into separate function. Need to
|
||||
// iterate over stops and print them in the
|
||||
// format: `AVN, PRI, SHH... etc.`
|
||||
for(var i = 0; i < json.length; i++) { // Hopefully can style output with CSS
|
||||
tableData += `<tr><td class="code">${json[i]['code']}</td>
|
||||
<td class="stops">${json[i]['stops']}</td></tr>`
|
||||
results++
|
||||
@ -48,7 +46,7 @@ async function insertData(json) {
|
||||
}
|
||||
|
||||
async function noData() {
|
||||
const msg = '<p>No results found</p>'
|
||||
const msg = '<p id="result-table">No results found</p>'
|
||||
document.getElementById('result-box').insertAdjacentHTML("beforeend", msg)
|
||||
}
|
||||
|
||||
@ -56,6 +54,6 @@ async function reset() {
|
||||
document.getElementById('origin').value = ""
|
||||
document.getElementById('destination').value = ""
|
||||
document.getElementById('result-box').style = 'display:none'
|
||||
document.getElementById('result-box').innerHTML = '' // This removes the <span> results-count. I need to remove the <table> ONLY.
|
||||
document.getElementById('result-table').remove()
|
||||
document.getElementById('crs-box').style = 'display:block'
|
||||
}
|
Reference in New Issue
Block a user