Skip to content

Commit

Permalink
修复了 登录失败 问题
Browse files Browse the repository at this point in the history
  • Loading branch information
aRLo077 committed Feb 23, 2025
1 parent 821b398 commit 19e7418
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions sendText.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
document.addEventListener("DOMContentLoaded", () => {
const askButton = document.getElementById("ask");
const questionInput = document.getElementById("question");

askButton.addEventListener("click", () => {
const text = questionInput.value;
if (text.trim() !== "") {
// Send the user's input to the server
sendTextToServer(text);
} else {
alert("Please enter a question.");
}
});

function sendTextToServer(text) {
fetch("/synthesize", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ text: text }),
})
.then((response) => response.text())
.then((data) => {
console.log(data); // Log the server's response
})
.catch((error) => {
console.error("Error:", error);
});
}
});

0 comments on commit 19e7418

Please sign in to comment.