let url = "https://jsonplaceholder.typicode.com/photos"; async function fetchAdatok(apiUrl){ try{ let response = await fetch(apiUrl); let data = await response.json(); data.forEach(element => { console.log(element); JsonElementToDomElement(element); }); } catch (error){ console.log(error); alert("Hiba Történt!"); } } fetchAdatok(url); let mainDomElement = document.getElementById("appendHere"); async function JsonElementToDomElement(element){ let newDomElement = document.createElement("div"); newDomElement.innerHTML = `${element.title}`; newDomElement.innerHTML += ``; mainDomElement.appendChild(newDomElement); }