10 lines
No EOL
679 B
JavaScript
10 lines
No EOL
679 B
JavaScript
const continentList = document.getElementById("continent-list");
|
|
fetch("https://countries.trevorblades.com/", { method: "POST", body: JSON.stringify({"query":"query allContinents { continents { name code }}","operationName":"allContinents"}), headers: { "Content-Type": "application/json" } }).then(response => response.json()).then(({data}) => {
|
|
const continents = data.continents;
|
|
document.getElementById("")
|
|
for (const continent of continents) {
|
|
const newListItem = document.createElement("li");
|
|
newListItem.innerHTML = `<a href="/continent.html?code=${continent.code}"> ${continent.name} </a>`;
|
|
continentList.append(newListItem);
|
|
}
|
|
}); |