Rimosso ID Pizza da form di aggiunta

This commit is contained in:
2025-12-04 09:06:48 +01:00
parent e67df056b6
commit 084cbb2b5f
2 changed files with 4 additions and 8 deletions

View File

@@ -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>

View File

@@ -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);
} }