diff --git a/js/timelaps.js b/js/timelaps.js index bdcccc2..bc81efd 100644 --- a/js/timelaps.js +++ b/js/timelaps.js @@ -43,16 +43,13 @@ function getKartsMenu() { 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("" + - " \n" + + " \n" + " \n" + " \n" + "\n" + - " "+value.name+"" + + " " + value.name + "" + " "); }); }, @@ -64,4 +61,75 @@ function getKartsMenu() { 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) { + alert('Request Status: ' + xhr.status + ' Status Text: ' + xhr.statusText + ' ' + xhr.responseText); + }, + }); } diff --git a/pilots.html b/pilots.html index 2275d1c..b5c8293 100644 --- a/pilots.html +++ b/pilots.html @@ -13,10 +13,15 @@ + + + + @@ -185,226 +190,6 @@
- -
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OrderShort NameFirst NameLast NameRef time (Sec)
- - - - - - - 1BGLNicolasRiault59
- - - - - - - 2BGLNicolasRiault59
- - - - - - - 3BGLNicolasRiault59
-
-
-
-
-
-
- Pilot list - OCK 2 - - - - -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OrderShort NameFirst NameLast NameRef time (Sec)
- - - - - - - 1BGLNicolasRiault59
- - - - - - - 2BGLNicolasRiault59
- - - - - - - 3BGLNicolasRiault59
-
-
-
-
-
-
- Pilot list - OCK 3 - - - - -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OrderShort NameFirst NameLast NameRef time (Sec)
- - - - - - - 1BGLNicolasRiault59
- - - - - - - 2BGLNicolasRiault59
- - - - - - - 3BGLNicolasRiault59
-
-
-
@@ -442,6 +227,8 @@ + + @@ -449,10 +236,11 @@ $(document).ready(function () { getKartsMenu(); - showKarts(); + getPilotsByKart(); }); +