Spaces:
Sleeping
Sleeping
File size: 869 Bytes
4c81dc7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
async function sendDataToBackend(inputData) {
try {
document.getElementById("loader").style.display = "block";
const response = await fetch(
`/getdata?input=${encodeURIComponent(inputData)}`
);
if (response.ok) {
const data = await response.json();
document.getElementById("loader").style.display = "none";
document.getElementById("summaryResult").innerText = data.summary;
}
} catch (error) {
console.error(error);
}
}
function handleSubmit(event) {
event.preventDefault();
const inputElement = document.getElementById("youtubeLinkInput");
const inputData = inputElement.value.trim();
if (inputData) {
sendDataToBackend(inputData);
}
}
document.addEventListener("DOMContentLoaded", () => {
const form = document.getElementById("summaryForm");
form.addEventListener("submit", handleSubmit);
});
|