Refactor fetchData function and add getLink function
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
// Sample data - you can replace this with your actual dataset
|
||||
const data = [];
|
||||
processor = new DataProcessor();
|
||||
dateStart='2024-03-27%2011:47:11'
|
||||
dateEnd="2024-03-27%2011:47:11"
|
||||
|
||||
// Function to create checkbox with label
|
||||
function createCheckBox(id, label) {
|
||||
@@ -110,9 +108,15 @@ function createFilterContainer() {
|
||||
document.body.appendChild(container);
|
||||
}
|
||||
|
||||
// Function to get the link for the get request
|
||||
function getLink(startDate, endDate, node) {
|
||||
return link = "http://getMeasurements?dateStart=" + startDate.toISOString() +
|
||||
"&dateEnd=" + endDate.toISOString() +
|
||||
"&node=" + node;
|
||||
}
|
||||
// Get request to fetch data from the server
|
||||
function fetchData() {
|
||||
fetch("http://145.92.8.114/getMeasurements?dateStart=2024-03-27%2011:47:11&dateEnd=2024-03-28%2011:47:11&node=113")
|
||||
function fetchData(link) {
|
||||
fetch(link)
|
||||
.then((response) => {
|
||||
if (!response.ok) {
|
||||
throw new Error("Network response was not ok");
|
||||
|
Reference in New Issue
Block a user