From f3c1fd2e7b54627e1f92a89b1989b4e3098f8ef5 Mon Sep 17 00:00:00 2001 From: morgane Date: Wed, 17 Jun 2026 20:05:07 +0000 Subject: [PATCH] Actualiser test.html --- test.html | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/test.html b/test.html index b5d9cc0..3f557aa 100644 --- a/test.html +++ b/test.html @@ -93,7 +93,6 @@ for (const checkbox of checkedBoxes) { let p = fullProductList[checkbox.dataset.index]; - // Utilisation de FormData pour garantir la compatibilité avec l'API let formData = new FormData(); for (let key in p) { formData.append(key, p[key]); @@ -101,18 +100,24 @@ formData.set('category', newCat); try { + // Ajout de credentials: 'include' pour envoyer tes cookies de connexion + // Ajout de X-Requested-With pour simuler une requête AJAX authentique let res = await fetch('api/index.php?action=product_save', { method: 'POST', - body: formData + body: formData, + credentials: 'include', + headers: { + 'X-Requested-With': 'XMLHttpRequest' + } }); if (res.ok) { successCount++; } else { - console.error("Erreur serveur sur " + p.name); + console.error("Erreur serveur sur " + p.name, res.status); errorCount++; } - await new Promise(r => setTimeout(r, 250)); + await new Promise(r => setTimeout(r, 300)); } catch (e) { console.error("Erreur réseau sur " + p.name, e); errorCount++;