-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathretailer.js
More file actions
38 lines (24 loc) · 946 Bytes
/
retailer.js
File metadata and controls
38 lines (24 loc) · 946 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
33
34
var arr=[];
var name=localStorage.getItem("un");
function add(){
document.getElementById('retailer').innerHTML+=`<li style="margin: 25px; width:300px; border:1px solid black; border-radius:5px;" class="list-group-item list-group-item-success" >${document.getElementById('item').value} Rs. ${document.getElementById('price').value} </li>`
var item=document.getElementById('item').value;
var price=document.getElementById('price').value;
arr.push([item,price])
document.getElementById('item').value=''
document.getElementById('price').value=''
}
function final(){
alert("List updated successfully");
axios.post('http://localhost:3001/retailers',{
menu: arr,
username: name
})
.then((response)=>{
console.log(response);
})
.catch((error)=>{
console.log(error);
})
document.getElementById('retailer').innerHTML=''
}