Rimosso ID Pizza da form di aggiunta
This commit is contained in:
6
add.html
6
add.html
@@ -8,12 +8,10 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form id="addForm" onsubmit="handleAddPizza(event)" >
|
<form id="addForm" onsubmit="handleAddPizza(event)" >
|
||||||
<label for="id">ID Pizza</label><br>
|
|
||||||
<input type="number" id="id" name="id" required><br>
|
|
||||||
<label for="name">Nome</label><br>
|
<label for="name">Nome</label><br>
|
||||||
<input type="text" id="name" name="name" required><br>
|
<input type="text" id="name" name="nome" required><br>
|
||||||
<label for="prezzo">Prezzo</label><br>
|
<label for="prezzo">Prezzo</label><br>
|
||||||
<input type="number" step="0.01" id="price" name="price" required><br><br>
|
<input type="number" step="0.01" id="price" name="prezzo" required><br><br>
|
||||||
<input type="submit" value="Aggiungi">
|
<input type="submit" value="Aggiungi">
|
||||||
</form>
|
</form>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -84,12 +84,11 @@ function editPizza(id){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addPizza(id, nome, prezzo){
|
function addPizza(nome, prezzo){
|
||||||
const myHeaders = new Headers();
|
const myHeaders = new Headers();
|
||||||
myHeaders.append("Content-Type", "application/json");
|
myHeaders.append("Content-Type", "application/json");
|
||||||
|
|
||||||
const raw = JSON.stringify({
|
const raw = JSON.stringify({
|
||||||
"id": id,
|
|
||||||
"nome": nome,
|
"nome": nome,
|
||||||
"prezzo": prezzo
|
"prezzo": prezzo
|
||||||
});
|
});
|
||||||
@@ -117,8 +116,7 @@ function handleAddPizza(event){
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
const nome = document.getElementById("name").value;
|
const nome = document.getElementById("name").value;
|
||||||
const id = document.getElementById("id").value;
|
|
||||||
const prezzo = document.getElementById("price").value;
|
const prezzo = document.getElementById("price").value;
|
||||||
|
|
||||||
addPizza(id, nome, prezzo);
|
addPizza(nome, prezzo);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user