psy4 / biz_v.html
DmitrMakeev's picture
Update biz_v.html
37e8529 verified
raw
history blame
1.28 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>API Request</title>
</head>
<body>
<h1>API Request</h1>
<label for="tokenInput">Enter Token:</label>
<input type="text" id="tokenInput" placeholder="Your Token">
<button id="sendRequestButton">Send Request</button>
<div id="responseArea"></div>
<script>
document.getElementById('sendRequestButton').addEventListener('click', function() {
const token = document.getElementById('tokenInput').value;
const url = '/send_request';
fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: 'token=' + encodeURIComponent(token)
})
.then(response => response.text())
.then(data => {
document.getElementById('responseArea').innerHTML = data;
})
.catch(error => {
console.error('Error:', error);
document.getElementById('responseArea').innerHTML = 'Error: ' + error.message;
});
});
</script>
</body>
</html>