mirror of
https://github.com/zzzzDev4/ias-tea-axum.git
synced 2025-04-21 07:41:21 +02:00
33 lines
No EOL
908 B
HTML
33 lines
No EOL
908 B
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>
|
|
</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 });
|
|
|
|
var requestOptions = {
|
|
method: 'POST',
|
|
headers: myHeaders,
|
|
body: raw,
|
|
redirect: 'follow'
|
|
};
|
|
|
|
fetch('https://ias-tea-axum.shuttleapp.rs/tea', requestOptions)
|
|
.then(response => response.text())
|
|
.then(result => console.log(result))
|
|
.catch(error => console.log('error', error));
|
|
});
|
|
</script> |