function clearList() {
    const request = new XMLHttpRequest();
    request.open('POST', '/clear-list');

    request.onload = () => {
        const data = JSON.parse(request.responseText);
        // Clear previous child elements first
        let list1Node = document.getElementById("list1");
        while(list1Node.firstChild) {
            list1Node.removeChild(list1Node.firstChild);
        }
    }

    // const data = new FormData();
    request.send();
}
// This function clears the list within the server by calling the Flask method
This function clears the list within the server by calling the Flask method
This function clears the list within the server by calling the Flask method
function clearList() {
    const request = new XMLHttpRequest();
    request.open('POST', '/clear-list');
    request.onload = () => {
        const data = JSON.parse(request.responseText);
        let list1Node = document.getElementById("list1");
        while(list1Node.firstChild) {
            list1Node.removeChild(list1Node.firstChild);
        }
    }
    request.send();
}
function clearList ( ) { const request = new XMLHttpRequest ( ) ; request . open ( 'POST' , '/clear-list' ) ; request . onload = ( ) => { const data = JSON . parse ( request . responseText ) ; let list1Node = document . getElementById ( "list1" ) ; while ( list1Node . firstChild ) { list1Node . removeChild ( list1Node . firstChild ) ; } } request . send ( ) ; }
This function clears the list within the server by calling the Flask method
This function clears the list within the server by calling the Flask method
// Clear previous child elements first // const data = new FormData();