week3Flask

This commit is contained in:
mohammedcifci78
2024-02-28 12:09:36 +01:00
parent a6cf98519a
commit e51a718d2a
6 changed files with 67 additions and 43 deletions

17
static/index.js Normal file
View File

@@ -0,0 +1,17 @@
function executeOperation(operationChoice) {
fetch(`/battery_voltage_events?operation=${operationChoice}`)
.then(response => {
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
return response.json(); // Gebruik response.json() om JSON-gegevens te parsen
})
.then(data => {
// Verwerk de gegevens zoals nodig
console.log(data); // Bekijk de gegevens in de console
})
.catch(error => {
console.error('Error:', error);
alert(`An error occurred: ${error.message}`);
});
}