rest hívások
This commit is contained in:
1 parent
4e9db4a538
commit
15ced67b41
3 files changed
+59
No files matched your search
@@ -0,0 +1,25 @@
|
||||
root=document.getElementById('root');
|
||||
|
||||
let keres=new XMLHttpRequest();
|
||||
let valasz="";
|
||||
|
||||
keres.open('GET','https://jsonplaceholder.typicode.com/posts',true);
|
||||
|
||||
keres.onload=function(){
|
||||
|
||||
valasz=JSON.parse(this.response);
|
||||
|
||||
console.log(valasz);
|
||||
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
Reference in new issue
Block a user