diff options
Diffstat (limited to 'python/gui/static')
-rw-r--r-- | python/gui/static/js/odr-predistortion.js | 17 | ||||
-rw-r--r-- | python/gui/static/js/odr.js | 16 |
2 files changed, 28 insertions, 5 deletions
diff --git a/python/gui/static/js/odr-predistortion.js b/python/gui/static/js/odr-predistortion.js index 7a93b2b..b2f1d22 100644 --- a/python/gui/static/js/odr-predistortion.js +++ b/python/gui/static/js/odr-predistortion.js @@ -18,6 +18,21 @@ // You should have received a copy of the GNU General Public License // along with ODR-DabMod. If not, see <http://www.gnu.org/licenses/>. +function resultrefresh() { + var jqxhr = doApiRequestGET("/api/dpd_results", function(data) { + $('#dpdresults').text(data['summary']); + }); + + jqxhr.always(function() { + setTimeout(resultrefresh, 2000); + }); +} + +$(function(){ + setTimeout(resultrefresh, 2000); +}); + +/* function calibraterefresh() { doApiRequestGET("/api/calibrate", function(data) { var text = "Captured TX signal and feedback." + @@ -92,6 +107,8 @@ $(function(){ }); }); +*/ + // ToolTip init $(function(){ diff --git a/python/gui/static/js/odr.js b/python/gui/static/js/odr.js index ecb02c5..0bf7729 100644 --- a/python/gui/static/js/odr.js +++ b/python/gui/static/js/odr.js @@ -20,7 +20,7 @@ function doApiRequestGET(uri, callback) { - $.ajax({ + return $.ajax({ type: "GET", url: uri, contentType: 'application/json', @@ -32,6 +32,8 @@ function doApiRequestGET(uri, callback) { errorWindow.document.write(data.responseText); } else { + console.log(data.responseText); + $.gritter.add({ title: 'API', text: "AJAX failed: " + data.statusText, image: '/fonts/warning.png', @@ -56,7 +58,7 @@ function doApiRequestGET(uri, callback) { } function doApiRequestPOST(uri, data, callback) { - $.ajax({ + return $.ajax({ type: "POST", url: uri, contentType: 'application/json', @@ -65,10 +67,14 @@ function doApiRequestPOST(uri, data, callback) { error: function(data) { if (data.status == 500) { - var errorWindow = window.open("", "_self"); + var windowObjectReference; + var winFeatures = "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes"; + var errorWindow = window.open("", "Error 500", winFeatures); errorWindow.document.write(data.responseText); } else { + console.log(data.responseText); + $.gritter.add({ title: 'API', text: "AJAX failed: " + data.statusText, @@ -100,10 +106,10 @@ function setRc(controllable, param, value, callback) { param: param, value: value }; - doApiRequestPOST("/api/parameter/", data, callback); + return doApiRequestPOST("/api/parameter/", data, callback); } function getRc(callback) { - doApiRequestGET("/api/rc_parameters", callback); + return doApiRequestGET("/api/rc_parameters", callback); } |