From 6b9ad004adc352d4caff4c1e52bfc02e4f0e9313 Mon Sep 17 00:00:00 2001 From: phl0 Date: Mon, 28 Aug 2023 15:21:56 +0200 Subject: [PATCH] Changed qralatlng to post --- application/controllers/Logbook.php | 4 ++- assets/js/sections/qso.js | 41 ++++++++++++++++++----------- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php index bf0d9bd1..7c198db7 100644 --- a/application/controllers/Logbook.php +++ b/application/controllers/Logbook.php @@ -1012,7 +1012,9 @@ class Logbook extends CI_Controller { return $latlng; } - function qralatlngjson($qra) { + function qralatlngjson() { + $qra = xss_clean($this->input->post('qra')); + log_message('debug','TEST QRA '.$qra); $this->load->library('Qra'); $latlng = $this->qra->qra2latlong($qra); print json_encode($latlng); diff --git a/assets/js/sections/qso.js b/assets/js/sections/qso.js index 6b9cba5f..777a82db 100644 --- a/assets/js/sections/qso.js +++ b/assets/js/sections/qso.js @@ -811,23 +811,32 @@ $("#locator").keyup(function(){ } if(qra_input.length >= 4 && $(this).val().length > 0) { - $.getJSON(base_url + 'index.php/logbook/qralatlngjson/' + $(this).val(), function(result) - { - // Set Map to Lat/Long - markers.clearLayers(); - if (typeof result !== "undefined") { - var redIcon = L.icon({ - iconUrl: icon_dot_url, - iconSize: [18, 18], // size of the icon - }); + $.ajax({ + url: base_url + 'index.php/logbook/qralatlngjson', + type: 'post', + data: { + qra: $(this).val(), + }, + success: function(data) { + // Set Map to Lat/Long + result = JSON.parse(data); + markers.clearLayers(); + if (typeof result[0] !== "undefined" && typeof result[1] !== "undefined") { + var redIcon = L.icon({ + iconUrl: icon_dot_url, + iconSize: [18, 18], // size of the icon + }); - var marker = L.marker([result[0], result[1]], {icon: redIcon}); - mymap.setZoom(8); - mymap.panTo([result[0], result[1]]); - mymap.setView([result[0], result[1]], 8); - } - markers.addLayer(marker).addTo(mymap); - }) + var marker = L.marker([result[0], result[1]], {icon: redIcon}); + mymap.setZoom(8); + mymap.panTo([result[0], result[1]]); + mymap.setView([result[0], result[1]], 8); + markers.addLayer(marker).addTo(mymap); + } + }, + error: function() { + }, + }); $.ajax({ url: base_url + 'index.php/logbook/searchbearing',