diff options
| author | Maksymilian Jopek <maks@jopek.eu> | 2022-03-24 14:31:15 +0100 |
|---|---|---|
| committer | Maksymilian Jopek <maks@jopek.eu> | 2022-03-24 14:31:15 +0100 |
| commit | 3f375f41a0d8176396da0a5988a9db06383e1636 (patch) | |
| tree | 89b8fa7232e73a9787b03f8d33847e63fcfdb393 /src | |
| parent | d1dcd0b49010bba31e44859e0d1d76abb7fb20fc (diff) | |
| download | alahelo-madio-3f375f41a0d8176396da0a5988a9db06383e1636.tar.gz alahelo-madio-3f375f41a0d8176396da0a5988a9db06383e1636.tar.zst alahelo-madio-3f375f41a0d8176396da0a5988a9db06383e1636.zip | |
Option to use or two xpaths ( speed )
Diffstat (limited to 'src')
| -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 = '' |
