Update biz_v.html
Browse files- biz_v.html +21 -21
biz_v.html
CHANGED
|
@@ -12,27 +12,27 @@
|
|
| 12 |
<button id="sendRequestButton">Send Request</button>
|
| 13 |
<textarea id="responseArea" rows="10" cols="50" readonly></textarea>
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
.
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
});
|
| 35 |
});
|
| 36 |
-
|
|
|
|
| 37 |
</body>
|
| 38 |
</html>
|
|
|
|
| 12 |
<button id="sendRequestButton">Send Request</button>
|
| 13 |
<textarea id="responseArea" rows="10" cols="50" readonly></textarea>
|
| 14 |
|
| 15 |
+
<script>
|
| 16 |
+
document.getElementById('sendRequestButton').addEventListener('click', function() {
|
| 17 |
+
const token = document.getElementById('tokenInput').value;
|
| 18 |
+
const url = '/send_request';
|
| 19 |
+
fetch(url, {
|
| 20 |
+
method: 'POST',
|
| 21 |
+
headers: {
|
| 22 |
+
'Content-Type': 'application/x-www-form-urlencoded'
|
| 23 |
+
},
|
| 24 |
+
body: 'token=' + encodeURIComponent(token)
|
| 25 |
+
})
|
| 26 |
+
.then(response => response.json())
|
| 27 |
+
.then(data => {
|
| 28 |
+
console.log('JSON Response:', data); // Вывод JSON-ответа в консоль
|
| 29 |
+
document.getElementById('responseArea').value = JSON.stringify(data, null, 2);
|
| 30 |
+
})
|
| 31 |
+
.catch(error => {
|
| 32 |
+
console.error('Error:', error);
|
| 33 |
+
document.getElementById('responseArea').value = 'Error: ' + error.message;
|
|
|
|
| 34 |
});
|
| 35 |
+
});
|
| 36 |
+
</script>
|
| 37 |
</body>
|
| 38 |
</html>
|