$(function() { function SortByQrg(a, b){ var a = a.frequency; var b = b.frequency; return ((a< b) ? -1 : ((a> b) ? 1 : 0)); } function fill_list(band,maxAgeMinutes) { let dxurl = dxcluster_provider + "/spots/" + band + "/" +maxAgeMinutes; $.ajax({ url: dxurl, cache: false, dataType: "json" }).done(function(dxspots) { var table = $('.spottable').DataTable(); table.clear(); table.page.len(50); table.order([1, 'asc']); if (dxspots.length>0) { dxspots.sort(SortByQrg); dxspots.forEach((single) => { // var data = [[ single.when_pretty, single.frequency, single.spotted, single.dxcc_spotted.call ]]; var data=[]; data[0]=[]; data[0].push(single.when_pretty); data[0].push(single.frequency); data[0].push((single.worked_call ?'' : '')+single.spotted+(single.worked_call ? '' : '')); data[0].push(single.dxcc_spotted.entity); table.rows.add(data).draw(); // add to datatable single }); } }); } fill_list($('#band option:selected').val(),30); setInterval(function () { fill_list($('#band option:selected').val(),30); },60000); $("#band").on("change",function() { fill_list($('#band option:selected').val(),30); }); var updateFromCAT = function() { if($('select.radios option:selected').val() != '0') { radioID = $('select.radios option:selected').val(); $.getJSON( "radio/json/" + radioID, function( data ) { if (data.error) { if (data.error == 'not_logged_in') { $(".radio_cat_state" ).remove(); if($('.radio_login_error').length == 0) { $('.messages').prepend('