-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
28 lines (22 loc) · 883 Bytes
/
Copy pathscript.js
File metadata and controls
28 lines (22 loc) · 883 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
let serverUrl = "http://127.0.0.1:5000/"
function getRatings(ab) {
fetch("http://127.0.0.1:5000/receiveFormData" + ab).then(res => res.json()).then(response => {
console.log(response);
for(var i in response) {
document.getElementById(i).innerHTML = response[i].toFixed(2);
}
})
}
function callBackend() {
fetch("http://127.0.0.1:5000/").then(res => res.json()).then(response => {
console.log(response);
document.getElementById('food_name').innerHTML = response.food_items[0];
document.getElementById('food_rating').innerHTML = response.food_items[1];
})
}
function callBackend2() {
fetch("http://127.0.0.1:5000/receiveFormData").then(res => res.json()).then(response => {
console.log(response);
document.getElementById('food_name').innerHTML = response.item3;
})
}