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