-
Notifications
You must be signed in to change notification settings - Fork 909
Expand file tree
/
Copy pathlesson18.html
More file actions
33 lines (29 loc) · 717 Bytes
/
lesson18.html
File metadata and controls
33 lines (29 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<html>
<body>
<script>
/*
const xhr = new XMLHttpRequest();
xhr.addEventListener('load', () => {
console.log(xhr.response);
});
xhr.open('GET', 'https://supersimplebackend.dev/greeting');
xhr.send();
*/
/*
fetch(
'https://supersimplebackend.dev/greeting'
).then((response) => {
return response.text();
}).then((text) => {
console.log(text);
});
*/
async function getGreeting() {
const response = await fetch('https://supersimplebackend.dev/greeting');
const text = await response.text();
console.log(text);
}
getGreeting();
</script>
</body>
</html>