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 ' '; } }, { data: "name" }, { data: "autonomy" } ] }); }, error: function (xhr) { $.notify("APIs unreachable!", "error"); console.log('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) { $.each(data, function (index, value) { $('#link_all').after("" + " \n" + " \n" + " \n" + "\n" + " " + value.name + "" + " "); }); }, error: function (xhr) { $.notify("APIs unreachable!", "error"); console.log('Request Status: ' + xhr.status + ' Status Text: ' + xhr.statusText + ' ' + xhr.responseText); }, }); } function getPilotsByKart() { $.ajax({ type: 'GET', crossDomain: true, url: api_url + 'karts/', dataType: 'json', success: function (data, status) { $.each(data, function (index, value) { $('.container-fluid').append("" + "
\n" + "
\n" + "
\n" + " Pilot list - "+value.name+" \n" + " \n" + " \n" + " \n" + "
\n" + "
\n" + "
\n" + "
\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "
OrderShort NameFirst NameLast NameRef time (Sec)
\n" + "
\n" + "
\n" + "
" + ""); $('#dataTable_pilots'+value.id).DataTable({ data: value.drivers, columns: [ { data: "id", render: function (data, type, row, meta) { return ' '; } }, { data: "order" }, { data: "first_name" }, { data: "first_name" }, { data: "last_name" }, { data: "ref_time" } ] }); }); }, error: function (xhr) { $.notify("APIs unreachable!", "error"); console.log('Request Status: ' + xhr.status + ' Status Text: ' + xhr.statusText + ' ' + xhr.responseText); }, }); }