function updateTodo()

in src/frontend/www/js/main.js [186:208]


function updateTodo(id, title, complete){
    var xmlhttp = new XMLHttpRequest();
    let form  = new FormData();
    form.append("title", title);
    form.append("complete", complete);

    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == XMLHttpRequest.DONE) {   // XMLHttpRequest.DONE == 4
           if (xmlhttp.status == 200) {
                listTodos();
           }
           else if (xmlhttp.status == 400) {
              alert('There was an error 400');
           }
           else {
               alert('something else other than 200 was returned');
           }
        }
    };

    xmlhttp.open("POST", basepath+"/"+ id, true);
    xmlhttp.send(form);
}