DmitrMakeev
commited on
Commit
•
51366c5
1
Parent(s):
3ada825
Update biz_v.html
Browse files- biz_v.html +44 -22
biz_v.html
CHANGED
@@ -10,29 +10,51 @@
|
|
10 |
<label for="tokenInput">Enter Token:</label>
|
11 |
<input type="text" id="tokenInput" placeholder="Your Token">
|
12 |
<button id="sendRequestButton">Send Request</button>
|
13 |
-
<
|
14 |
|
15 |
-
<script>
|
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>
|
|
|
10 |
<label for="tokenInput">Enter Token:</label>
|
11 |
<input type="text" id="tokenInput" placeholder="Your Token">
|
12 |
<button id="sendRequestButton">Send Request</button>
|
13 |
+
<div id="responseArea"></div>
|
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 |
+
displayData(data);
|
30 |
+
})
|
31 |
+
.catch(error => {
|
32 |
+
console.error('Error:', error);
|
33 |
+
document.getElementById('responseArea').innerHTML = 'Error: ' + error.message;
|
34 |
+
});
|
35 |
});
|
36 |
+
|
37 |
+
function displayData(data) {
|
38 |
+
const responseArea = document.getElementById('responseArea');
|
39 |
+
responseArea.innerHTML = ''; // Очищаем предыдущий контент
|
40 |
+
|
41 |
+
if (data.list && data.list.length > 0) {
|
42 |
+
data.list.forEach(item => {
|
43 |
+
const webinarDiv = document.createElement('div');
|
44 |
+
webinarDiv.innerHTML = `
|
45 |
+
<h2>${item.name}</h2>
|
46 |
+
<p>${item.text}</p>
|
47 |
+
<p>Type: ${item.type}</p>
|
48 |
+
<p>Participants: ${item.count1}</p>
|
49 |
+
<p>Duration: ${item.count2} minutes</p>
|
50 |
+
<p>Created: ${item.created}</p>
|
51 |
+
`;
|
52 |
+
responseArea.appendChild(webinarDiv);
|
53 |
+
});
|
54 |
+
} else {
|
55 |
+
responseArea.innerHTML = 'No webinars found.';
|
56 |
+
}
|
57 |
+
}
|
58 |
+
</script>
|
59 |
</body>
|
60 |
</html>
|