mirror of
https://github.com/zzzzDev4/ias-tea-axum.git
synced 2025-04-21 07:41:21 +02:00
43 lines
No EOL
1.2 KiB
HTML
43 lines
No EOL
1.2 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Tea Homepage</title>
|
|
</head>
|
|
<body>
|
|
<p>Tea is great.</p>
|
|
<input type="text" id="myInput">
|
|
<button id="myButton">Click me if you want tea!</button>
|
|
<a href="https://ias-tea-axum.shuttleapp.rs/alltea">
|
|
<button id="myAllteaButton">ALL THE TEA!</button>
|
|
</a>
|
|
</body>
|
|
</html>
|
|
|
|
<script>
|
|
document.getElementById('myButton').addEventListener('click', function() {
|
|
var myHeaders = new Headers();
|
|
myHeaders.append('Content-Type', 'application/json');
|
|
|
|
var inputValue = document.getElementById('myInput').value;
|
|
var raw = JSON.stringify(
|
|
{
|
|
"teaname": inputValue,
|
|
"rfidcode": "b76Dfo42",
|
|
"watertemp": 90,
|
|
"steepingseconds": 120,
|
|
}
|
|
);
|
|
|
|
var requestOptions = {
|
|
method: 'POST',
|
|
headers: myHeaders,
|
|
body: raw,
|
|
redirect: 'follow'
|
|
};
|
|
|
|
fetch('https://ias-tea-axum.shuttleapp.rs/addtea', requestOptions)
|
|
.then(response => response.text())
|
|
.then(result => console.log(result))
|
|
.catch(error => console.log('error', error));
|
|
});
|
|
</script> |