-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlist.js
More file actions
51 lines (35 loc) · 1.54 KB
/
list.js
File metadata and controls
51 lines (35 loc) · 1.54 KB
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
42
43
44
45
46
47
48
49
50
var use=localStorage.getItem("un");
function list(){
axios.get(`http://localhost:3001/retailers`)
.then((response)=>{
console.log(response)
console.log(use)
var size=response.data.length
for(let i=0;i<size;i++)
{
console.log(response.data[i].username)
if(response.data[i].username==use){
var sizee=response.data[i].menu.length
for(let j=0;j<sizee;j++){
document.getElementById('list').innerHTML+=`
<table style="width:20%; margin-left: 5%; background-color: aqua">
<tr style="border: 1px solid white; ">
<th style="border: 1px solid white;">Name of Item</th>
<th style="border: 1px solid white;">Price of Item</th>
</tr>
<tr style="border: 1px solid white; ">
<td style="border: 1px solid white;">${response.data[i].menu[j][0]}</td>
<td style="border: 1px solid white;">${response.data[i].menu[j][1]}</td>
</tr>
`
}
}
}
})
.catch((err) => {
console.log(err)
})
}
{/* <li style="margin: 25px; width:400px; border:1px solid black; border-radius:5px;" class="list-group-item list-group-item-success"><span> Product: ${response.data[i].menu[j][0]}</span>
<span>Price: Rs. ${response.data[i].menu[j][1]}</span>
</li> */}