68 lines
2.1 KiB
JavaScript
68 lines
2.1 KiB
JavaScript
var api_url = 'http://timelaps.local:8000/api/v1/';
|
|
|
|
function getParams() {
|
|
|
|
}
|
|
|
|
function showKarts() {
|
|
$.ajax({
|
|
type: 'GET',
|
|
crossDomain: true,
|
|
url: api_url + 'karts/',
|
|
dataType: 'json',
|
|
success: function (data, status) {
|
|
console.log(data);
|
|
$('#dataTable_kart_list').DataTable({
|
|
data: data,
|
|
columns: [
|
|
{
|
|
data: "id",
|
|
render: function (data, type, row, meta) {
|
|
return '<a href="#" class="btn btn-primary btn-circle"><i class="fas fa-edit"></i></a> <a href="#" class="btn btn-danger btn-circle"><i class="fas fa-trash"></i>';
|
|
}
|
|
},
|
|
{
|
|
data: "name"
|
|
},
|
|
{
|
|
data: "autonomy"
|
|
}
|
|
]
|
|
});
|
|
},
|
|
error: function (xhr) {
|
|
alert('Request Status: ' + xhr.status + ' Status Text: ' + xhr.statusText + ' ' + xhr.responseText);
|
|
},
|
|
});
|
|
}
|
|
|
|
function getKartsMenu() {
|
|
$.ajax({
|
|
type: 'GET',
|
|
crossDomain: true,
|
|
url: api_url + 'karts/',
|
|
dataType: 'json',
|
|
success: function (data, status) {
|
|
console.log(data);
|
|
$.each(data, function (index, value) {
|
|
console.log(index);
|
|
console.log(value.name);
|
|
$('#link_all').after("" +
|
|
" <a id=\"link_"+value.id+"\" href=\"#\" class=\"btn btn-light btn-icon-split btn-sm\">\n" +
|
|
" <span class=\"icon text-gray-600\">\n" +
|
|
" <i class=\"fas fa-car\"></i>\n" +
|
|
"</span>\n" +
|
|
" <span class=\"text\">"+value.name+"</span>" +
|
|
" </a>");
|
|
});
|
|
},
|
|
error: function (xhr) {
|
|
alert('Request Status: ' + xhr.status + ' Status Text: ' + xhr.statusText + ' ' + xhr.responseText);
|
|
},
|
|
});
|
|
}
|
|
|
|
function getPilotsByKart() {
|
|
|
|
}
|