-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcafe.js
More file actions
32 lines (23 loc) · 771 Bytes
/
cafe.js
File metadata and controls
32 lines (23 loc) · 771 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
onclick.getelementById('switch1');{
let xhr = new XMLHttpRequest();
xhr.open("POST", "https://newslet-server.herokuapp.com/cafeteria");
xhr.setRequestHeader("Accept", "application/json");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.onload = () => console.log(xhr.responseText);
let data = `{
"cafe":"lipton",
}`;
xhr.send(data);
}
onclick.getelementById('switch2');{
let xhr = new XMLHttpRequest();
xhr.open("POST", "https://newslet-server.herokuapp.com/cafeteria");
xhr.setRequestHeader("Accept", "application/json");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.onload = () => console.log(xhr.responseText);
let data = `{
"cafe":"sagar",
}`;
xhr.send(data);
}
//© 2022 GitHub, Inc.