-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInventory.js
More file actions
24 lines (21 loc) · 823 Bytes
/
Inventory.js
File metadata and controls
24 lines (21 loc) · 823 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
//change fetch address
fetch('https://mile12db.azurewebsites.net/api/all_products')
.then(function(response){
//console.log(response.text());
return response.text();
}).then(function(text){
return JSON.parse(text);
})
.then(function(text){
for ( let i =0; i<Object.values(text).length;i++)
{
document.getElementById('div3').innerHTML +=
`<div class = 'box'>
<strong>Product : ${Object.values(text)[i]['Product Name']} </strong> <br>
Name of Co-op : ${Object.values(text)[i]['Coop']} <br>
Price : ${Object.values(text)[i]['Price']} <br>
Contact : ${Object.values(text)[i]['Contact']}
<button id = ${'button' +i} style='float:right'>Purchase</button>
</div>`;
}
});