Add Spot page to take mode options from API #71

This commit is contained in:
Ian Renton
2025-11-01 12:03:11 +00:00
parent 812d031a2c
commit 1ed543872a
2 changed files with 34 additions and 10 deletions

View File

@@ -1,3 +1,23 @@
// Load server options. Once a successful callback is made from this, we can populate the choice boxes in the form and load
// any saved values from local storage.
function loadOptions() {
$.getJSON('/api/v1/options', function(jsonData) {
// Store options
options = jsonData;
// Populate modes drop-down
$.each(options["modes"], function (i, m) {
$('#mode').append($('<option>', {
value: m,
text : m
}));
});
// Load settings from settings storage now all the controls are available
loadSettings();
});
}
// Method called to add a spot to the server
function addSpot() {
try {
@@ -7,7 +27,7 @@ function addSpot() {
// Unpack the user's entered values
var dx = $("#dx-call").val().toUpperCase();
var freqStr = $("#freq").val();
var mode = $("#mode").val().toUpperCase();
var mode = $("#mode")[0].value;
var dxGrid = $("#dx-grid").val();
var comment = $("#comment").val();
var de = $("#de-call").val().toUpperCase();
@@ -93,8 +113,8 @@ function displayIntroBox() {
// Startup
$(document).ready(function() {
// Load settings from settings storage
loadSettings();
// Load options
loadOptions();
// Display intro box
displayIntroBox();
});