DmitrMakeev commited on
Commit
51366c5
1 Parent(s): 3ada825

Update biz_v.html

Browse files
Files changed (1) hide show
  1. 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
- <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>
 
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>