function requestList() {
    // Create a request object and call Flask method
    const request = new XMLHttpRequest();
    request.open('POST', '/list-memory');

    let currentValue = document.querySelector('#userInput1').value;

    request.onload = () => {
        const data = JSON.parse(request.responseText);
        // Call helper function that updates the div 
        appendList(data, "list1");         
    }

    // Add data to send with request. NECESSARY or else Flask will get None value on request.form.get("userInput1")
    const data = new FormData();
    if (currentValue.length !== 0) {
        data.append('userInput1', currentValue);
    }
    request.send(data);
}
// This function gets the list from the server and updates its contents
This function gets the list from the server and updates its contents
This function gets the list from the server and updates its contents
function requestList() {
    const request = new XMLHttpRequest();
    request.open('POST', '/list-memory');
    let currentValue = document.querySelector('#userInput1').value;
    request.onload = () => {
        const data = JSON.parse(request.responseText);
        appendList(data, "list1");         
    }
    const data = new FormData();
    if (currentValue.length !== 0) {
        data.append('userInput1', currentValue);
    }
    request.send(data);
}
function requestList ( ) { const request = new XMLHttpRequest ( ) ; request . open ( 'POST' , '/list-memory' ) ; let currentValue = document . querySelector ( '#userInput1' ) . value ; request . onload = ( ) => { const data = JSON . parse ( request . responseText ) ; appendList ( data , "list1" ) ; } const data = new FormData ( ) ; if ( currentValue . length !== 0 ) { data . append ( 'userInput1' , currentValue ) ; } request . send ( data ) ; }
This function gets the list from the server and updates its contents
This function gets the list from the server and updates its contents
// Create a request object and call Flask method // Call helper function that updates the div  // Add data to send with request. NECESSARY or else Flask will get None value on request.form.get("userInput1")