diff options
Diffstat (limited to 'src/main.ts')
| -rw-r--r-- | src/main.ts | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/main.ts b/src/main.ts index 7ecd320..2406f04 100644 --- a/src/main.ts +++ b/src/main.ts @@ -5,11 +5,11 @@ const URL = "http://localhost:8000/index.php"; (async () => { const voivs = await (await fetch(URL)).json() as string[] const tbody = document.getElementById('tds-here') as HTMLTableSectionElement; - for (let i = 0; i < voivs.length; i += 2) { + for (const v of voivs) { const tr = document.createElement("tr") const td = document.createElement("td") - td.innerText = voivs[i + 1] - td.onclick = () => showCities(voivs[i + 1], voivs[i]); + td.innerText = v + td.onclick = () => showCities(v, v); tr.appendChild(td) tbody.appendChild(tr) } @@ -20,7 +20,6 @@ async function showCities(n: string, id: string) { method: "POST", body: id, })).json() as string[] - // console.log(res) const nh = document.getElementById("name-here") as HTMLTableRowElement const vt = document.getElementById("vtds-here") as HTMLTableSectionElement vt.innerHTML = '' |
