up_fail / ns_info.html
DmitrMakeev's picture
Update ns_info.html
3faf523 verified
raw
history blame
2.37 kB
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Получение информации о группе</title>
</head>
<body>
<h1>Получение списка параметров группы</h1>
<form id="groupForm">
<label for="groupId">Идентификатор группы:</label>
<input type="text" id="groupId" name="groupId" required>
<br>
<label for="apiToken">API Токен:</label>
<input type="text" id="apiToken" name="apiToken" required>
<br>
<button type="submit">Получить список параметров группы</button>
</form>
<div id="result"></div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const groupForm = document.getElementById('groupForm');
const resultDiv = document.getElementById('result');
groupForm.addEventListener('submit', function(event) {
event.preventDefault();
const groupId = document.getElementById('groupId').value;
const apiToken = document.getElementById('apiToken').value;
const url = `https://diamonik7777-up-fail.hf.space/api/group/${groupId}/parameters?apiToken=${apiToken}`;
fetch(url, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
})
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok ' + response.statusText);
}
return response.json();
})
.then(data => {
if (data.error) {
resultDiv.innerHTML = `<p style="color: red;">Ошибка: ${data.error}</p>`;
} else {
resultDiv.innerHTML = `<pre>${JSON.stringify(data, null, 2)}</pre>`;
}
})
.catch(error => {
resultDiv.innerHTML = `<p style="color: red;">Ошибка: ${error.message}</p>`;
});
});
});
</script>
</body>
</html>