Képek és Tailwind

This commit is contained in:
Kovács Rudolf committed 2026-11-09 09:23:52 +01:00
1 parent 15ced67b41
commit 464230982d
3 files changed
+74 -5

No files matched your search

+31 -5
View File
@@ -13,13 +13,39 @@ keres.onload=function(){
}
keres.send();
//keres.send();
console.log(valasz);
fetch('https://jsonplaceholder.typicode.com/posts')
.then(res=>res.json())
.then(adat=>console.log(adat))
.catch(error=>console.log(error));
//Kérések fajtái: GET, POST, PUT, PATCH, DELETE, OPTIONS
// fetch('https://jsonplaceholder.typicode.com/posts')
// .then(res=>res.json())
// .then(adat=>console.log(adat))
// .catch(error=>console.log(error));
//async await
async function letolt() {
try {
let keres=await fetch('https://jsonplaceholder.typicode.com/posts');
let valasz=await keres.json();
console.log(valasz);
valasz.forEach(post => {
let p=document.createElement('p');
let body=document.createElement('p');
body.textContent=post.body;
p.textContent=post.title;
root.appendChild(p);
root.appendChild(body);
});
} catch (error) {
alert(error);
}
}
letolt();