Képek és Tailwind
This commit is contained in:
1 parent
15ced67b41
commit
464230982d
3 files changed
+74
-5
No files matched your search
+31
-5
@@ -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();
|
||||
Reference in new issue
Block a user