Spaces:
Sleeping
Sleeping
File size: 975 Bytes
4c81dc7 891fb1e 4c81dc7 6a5cebd 4c81dc7 6a5cebd 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 31 |
async function sendDataToBackend(inputData) {
try {
document.getElementById("loader").style.display = "block";
const response = await fetch(`/getdata?input=${inputData}`);
if (response.ok) {
const data = await response.json();
document.getElementById("loader").style.display = "none";
document.getElementById("summaryResult").innerText = data.summary;
}
} catch (error) {
document.getElementById("loader").style.display = "none";
console.error(error);
} finally {
document.getElementById("loader").style.display = "none";
}
}
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);
});
|