2025-04-27 19:54:42 -04:00

21 lines
774 B
JavaScript

function clearInput() {
$('#download_field').val(''); // Clear the input field
}
// Handle the form submission with AJAX
$(document).ready(function () {
$('#ydl_download').submit(function (event) {
event.preventDefault(); // Prevent the default form submission
alert("File is now downloading");
$.ajax({
type: 'POST', // Use POST method to send data
url: '/ydl', // Target URL for the CherryPy handler
data: $('#ydl_download').serializeArray(), // Serialize the form data
success: function (data) {
$('#downloadResult').html(data); // Display the result in the specified div
alert("File has finished downloading");
}
});
});
});