16 lines
442 B
JavaScript
16 lines
442 B
JavaScript
function sendData(data) {
|
|
fetch('http://localhost:5000/api/send', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({ message: data })
|
|
})
|
|
.then(res => res.json())
|
|
.then(data => {
|
|
document.getElementById('response').innerText = data.reply;
|
|
})
|
|
.catch(err => console.error('Error:', err));
|
|
}
|
|
|
|
sendData("reset") |