translation update
This commit is contained in:
parent
f8ccd73ba6
commit
84add80342
13
items.php
13
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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user