Created
December 13, 2020 10:10
-
-
Save anLpk/6b5c8c65f3834fa38a98d60c90b6e8a1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // // console.log("Hello from inside"); // Always check, JS working or not | |
| const input = document.querySelector("#results"); | |
| const search = document.querySelector("#btn"); | |
| const url = "data.JSON"; | |
| async function loadJSON(url) { | |
| const res = await fetch(url); | |
| return await res.json(); | |
| } | |
| loadJSON(url).then((obj) => { | |
| console.log(obj.data); | |
| // obj.input.forEach((element) => { | |
| // console.log(element); | |
| // const showIt = ` | |
| // <li> | |
| // <p>${element.nufus}</p> | |
| // <p>${element.yuzolcumu}</p> | |
| // <p>${element.bolge}</p> | |
| // <p>${element.erkek_nufus_yuzde}</p> | |
| // <p>${element.kadin_nufus_yuzde}</p> | |
| // </li> | |
| // `; | |
| // input.insertAdjacentHTML("beforeend", showIt); | |
| // }); | |
| }); | |
| // search.addEventListener("click", (event) => { | |
| // event.preventDefault(); | |
| // const input = event.currentTarget.querySelector(".form-control"); | |
| // results.innerHTML = ""; | |
| // loadJSON(input); | |
| // }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment