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() {
|
||||
const data = {
|
||||
id: document.getElementById('prod-id').value, // Ajoute un champ pour l'ID
|
||||
name: document.getElementById('prod-name').value,
|
||||
category: document.getElementById('category-selector').value
|
||||
};
|
||||
|
||||
// Appel API pour la réconciliation
|
||||
fetch('api/index.php?action=update_product', {
|
||||
// Remplace 'update_product' par l'action trouvée dans ton onglet Réseau
|
||||
fetch('api/index.php?action=product_edit', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(data)
|
||||
})
|
||||
.then(r => r.json())
|
||||
.then(res => alert("Réponse API : " + JSON.stringify(res)))
|
||||
.catch(e => alert("Erreur d'envoi : " + e));
|
||||
.then(res => {
|
||||
console.log("Réponse :", res);
|
||||
alert("Action effectuée avec succès !");
|
||||
})
|
||||
.catch(e => alert("Erreur : " + e));
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user