mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-10-27 08:49:27 +00:00
Various stuff
This commit is contained in:
@@ -1,17 +1,19 @@
|
||||
$.getJSON('/api/spots', function(jsonData) {
|
||||
let headers = Object.keys(jsonData[0]);
|
||||
let table = $('<table>').append('<thead><tr></tr></thead><tbody></tbody>');
|
||||
let table = $('<table class="table table-striped table-hover">').append('<thead><tr class="table-primary"></tr></thead><tbody></tbody>');
|
||||
["Time", "DX", "Frequency", "Mode", "Comment", "Source", "DE"].forEach(header => table.find('thead tr').append(`<th>${header}</th>`));
|
||||
|
||||
jsonData.forEach(row => {
|
||||
let $tr = $('<tr>');
|
||||
$tr.append(`<td>${row["time"]}</td>`);
|
||||
$tr.append(`<td>${row["dx_call"]}</td>`);
|
||||
var time = moment(row["time"], moment.ISO_8601);
|
||||
var time_formatted = time.format("HH:mm")
|
||||
$tr.append(`<td>${time_formatted}</td>`);
|
||||
$tr.append(`<td>${row["dx_flag"]} ${row["dx_call"]}</td>`);
|
||||
$tr.append(`<td>${row["freq"]}</td>`);
|
||||
$tr.append(`<td>${row["mode"]}</td>`);
|
||||
$tr.append('<td>').append(escapeHtml(`${row["comment"]}`)).append('</td>');
|
||||
$tr.append('<td>' + escapeHtml(`${row["comment"]}`) + '</td>');
|
||||
$tr.append(`<td>${row["source"]}</td>`);
|
||||
$tr.append(`<td>${row["de_call"]}</td>`);
|
||||
$tr.append(`<td>${row["de_flag"]} ${row["de_call"]}</td>`);
|
||||
table.find('tbody').append($tr);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user