Skip to content

Instantly share code, notes, and snippets.

@anLpk
Created December 13, 2020 10:10
Show Gist options
  • Select an option

  • Save anLpk/6b5c8c65f3834fa38a98d60c90b6e8a1 to your computer and use it in GitHub Desktop.

Select an option

Save anLpk/6b5c8c65f3834fa38a98d60c90b6e8a1 to your computer and use it in GitHub Desktop.
// // 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