-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex_server.html
48 lines (31 loc) · 1.24 KB
/
index_server.html
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
34
35
36
37
38
39
40
41
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<h1 id="hi">hhhhh</h1>
<h2 id="hi2">hhhhh</h2>
<h3 id="hi3">hhhhh</h3>
<h4 id="hi4">hhhhh</h4>
<script type="text/javascript">
// gets expiry list from backend, put it on h1
$.get( "/elist",function(data) {
$("#hi").text(data);
console.log(data);
});
// gets expiry list from backend, put it on h1
$.get( "/ltf",function(data) {
$("#hi2").text(data);
console.log(data);
});
$.post( "/returnList",
{"name": "banana", "date": "12/13/2019", "quantity": "8", "calories": "420",
"pic": "https://media.istockphoto.com/photos/banana-picture-id636739634?k=6&m=636739634&s=612x612&w=0&h=BQ9Z6DobjFzclh3LN7nKSljrRqycJPCq65CS8rtUHU4="},
function(data ) {
$("#hi3").text(JSON.stringify(data))
console.log(data);
});
// list of data --> remove, connects to the removeFood(name,quantity) function
$.post( "/removeList", {"name": "banana", "date": "12/13/2019", "quantity": "8", "calories": "420",
"pic": "https://media.istockphoto.com/photos/banana-picture-id636739634?k=6&m=636739634&s=612x612&w=0&h=BQ9Z6DobjFzclh3LN7nKSljrRqycJPCq65CS8rtUHU4="},
function(data ) {
$("#hi4").text(JSON.stringify(data))
console.log(data);
});
</script>