Actualiser test.html
CI / PHP Syntax Check (push) Has been cancelled
CI / JavaScript Lint (push) Has been cancelled
CI / Docker Build Test (push) Has been cancelled
CI / Validate Translation Files (push) Has been cancelled
CI / Auto-merge develop → main (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / PHP Syntax Check (push) Has been cancelled
CI / JavaScript Lint (push) Has been cancelled
CI / Docker Build Test (push) Has been cancelled
CI / Validate Translation Files (push) Has been cancelled
CI / Auto-merge develop → main (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
This commit is contained in:
@@ -68,19 +68,23 @@
|
|||||||
|
|
||||||
function saveProduct() {
|
function saveProduct() {
|
||||||
const data = {
|
const data = {
|
||||||
|
id: document.getElementById('prod-id').value, // Ajoute un champ pour l'ID
|
||||||
name: document.getElementById('prod-name').value,
|
name: document.getElementById('prod-name').value,
|
||||||
category: document.getElementById('category-selector').value
|
category: document.getElementById('category-selector').value
|
||||||
};
|
};
|
||||||
|
|
||||||
// Appel API pour la réconciliation
|
// Remplace 'update_product' par l'action trouvée dans ton onglet Réseau
|
||||||
fetch('api/index.php?action=update_product', {
|
fetch('api/index.php?action=product_edit', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify(data)
|
body: JSON.stringify(data)
|
||||||
})
|
})
|
||||||
.then(r => r.json())
|
.then(r => r.json())
|
||||||
.then(res => alert("Réponse API : " + JSON.stringify(res)))
|
.then(res => {
|
||||||
.catch(e => alert("Erreur d'envoi : " + e));
|
console.log("Réponse :", res);
|
||||||
|
alert("Action effectuée avec succès !");
|
||||||
|
})
|
||||||
|
.catch(e => alert("Erreur : " + e));
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Reference in New Issue
Block a user