API

Владимир5 years ago

Добрый день.

Помогите с запросом к API. Выполняю GET запрос, запрос выполняется данные вижу в консоли браузера но не знаю как их правильно вывести на страницу сайта в таблицу.

<!DOCTYPE html>
<html>
<head>
<meta charset="ru">
<title>try traccar api</title>
</head>
<body>

<style>
#res { border-collapse: collapse; border-color: silver;}
#res tr:first-child { font-weight: bold; }
</style>

<table id="res" border="1">
<tr>
<td>attributes</td>
<td>groupId</td>
<td> name</td>
<td>uniqueId</td>
<td>status</td>
<td>lastUpdate</td>
</tr>
</table>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>

<script type="text/javascript">
$.ajax({
type: 'get',
url: 'http://81.177.136.11:8082/api/devices/',

headers: {

"Authorization": "Basic " + btoa("admin:admin")

},
success: function (response) {
console.log(response);

}

});
</script>
</body>
</html>