var requestsDiv = document.getElementById("requests"); function getRequests(count,allRequests) { var reqUrl; if (allRequests) { reqUrl = "/api/getAllRequests"; } else { reqUrl = "/api/getRequests"; } reqUrl += `?count=${count}`; fetch(reqUrl) .then(response => response.json()) .then(requests => buildTable(requests,allRequests)); } function buildTable(requests,allRequests) { var requestsDivHTML = '
URL | Requester | Score | '; if (allRequests) requestsDivHTML += `State |
---|---|---|---|
${request.url} | \${request.requester} | \${request.score} | `; if (allRequests) requestsDivHTML += `${request.state} |