Abubakari's picture
update
1ef167e
raw
history blame
751 Bytes
document.addEventListener('DOMContentLoaded', () => {
const form = document.querySelector('#sepsis-prediction form');
const result = document.querySelector('#sepsis-result');
form.addEventListener('submit', async (event) => {
event.preventDefault();
const formData = new FormData(form);
const urlParams = new URLSearchParams(formData);
const url = `/sepsis/predict?${urlParams.toString()}`;
try {
const response = await fetch(url);
const data = await response.json();
result.textContent = data.statement;
} catch (error) {
console.error('Error:', error);
result.textContent = 'An error occurred while processing the request.';
}
});
});