diff --git a/items.php b/items.php index 6c3d13d..03045f2 100644 --- a/items.php +++ b/items.php @@ -759,15 +759,18 @@ function translateField(sourceId, targetId, direction) { const text = document.getElementById(sourceId).value; if (!text) return; - fetch('api/translate.php', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ text, direction }) + const formData = new FormData(); + formData.append("text", text); + formData.append("direction", direction); + + fetch("api/translate.php", { + method: "POST", + body: formData }) .then(res => res.json()) .then(data => { if (data.success) { - document.getElementById(targetId).value = data.translated; + document.getElementById(targetId).value = data.translation; } }); }