function loadTasks() {
  fetch('/data').then(response => response.json()).then((messages) => {
    const messagesListEl = document.getElementById('task-list');
    messages.forEach((message) => {
      const messageEl = document.createElement('li');
      messageEl.className = "Message";
      messageEl.innerHTML ='';
      messageEl.appendChild(createListElement(message.comment));
      messageEl.appendChild(createListElement("---"));
      messageEl.appendChild(createListElement(message.timestamp));
      messageEl.appendChild(document.createElement('hr'));
      messagesListEl.appendChild(messageEl);
    })
  });
}
/** Fetches tasks from the server and adds them to the DOM. */
Fetches tasks from the server and adds them to the DOM.
Fetches tasks from the server and adds them to the DOM .
function loadTasks() {
  fetch('/data').then(response => response.json()).then((messages) => {
    const messagesListEl = document.getElementById('task-list');
    messages.forEach((message) => {
      const messageEl = document.createElement('li');
      messageEl.className = "Message";
      messageEl.innerHTML ='';
      messageEl.appendChild(createListElement(message.comment));
      messageEl.appendChild(createListElement("---"));
      messageEl.appendChild(createListElement(message.timestamp));
      messageEl.appendChild(document.createElement('hr'));
      messagesListEl.appendChild(messageEl);
    })
  });
}
function loadTasks ( ) { fetch ( '/data' ) . then ( response => response . json ( ) ) . then ( ( messages ) => { const messagesListEl = document . getElementById ( 'task-list' ) ; messages . forEach ( ( message ) => { const messageEl = document . createElement ( 'li' ) ; messageEl . className = "Message" ; messageEl . innerHTML = '' ; messageEl . appendChild ( createListElement ( message . comment ) ) ; messageEl . appendChild ( createListElement ( "---" ) ) ; messageEl . appendChild ( createListElement ( message . timestamp ) ) ; messageEl . appendChild ( document . createElement ( 'hr' ) ) ; messagesListEl . appendChild ( messageEl ) ; } ) } ) ; }
Fetches tasks from the server and adds them to the DOM.
Fetches tasks from the server and adds them to the DOM .