From 0a4a6b16c380d25ca0a2fca77a6853b29628c128 Mon Sep 17 00:00:00 2001 From: Sebastien Date: Wed, 16 Oct 2019 11:20:33 -0400 Subject: [PATCH] fix squeezelite startup toggle --- components/wifi-manager/code.js | 38 ++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/components/wifi-manager/code.js b/components/wifi-manager/code.js index 9aa6e85e..857481fc 100644 --- a/components/wifi-manager/code.js +++ b/components/wifi-manager/code.js @@ -194,21 +194,29 @@ $(document).ready(function(){ console.log(thrownError); if (thrownError != '') showMessage(thrownError, 'ERROR'); } - }); - console.log('sent config JSON with headers:', autoexec); - console.log('now triggering reboot'); - $.ajax({ - url: '/reboot.json', - dataType: 'text', - method: 'POST', - cache: false, - contentType: 'application/json; charset=utf-8', - data: JSON.stringify({ 'timestamp': Date.now()}), - error: function (xhr, ajaxOptions, thrownError) { - console.log(xhr.status); - console.log(thrownError); - if (thrownError != '') showMessage(thrownError, 'ERROR'); - } + complete: function(response) { + var returnedResponse = JSON.parse(response.responseText); + console.log(response.responseText); + console.log('sent config JSON with headers:', autoexec); + console.log('now triggering reboot'); + $.ajax({ + url: '/reboot.json', + dataType: 'text', + method: 'POST', + cache: false, + contentType: 'application/json; charset=utf-8', + data: JSON.stringify({ 'timestamp': Date.now()}), + error: function (xhr, ajaxOptions, thrownError) { + console.log(xhr.status); + console.log(thrownError); + if (thrownError != '') showMessage(thrownError, 'ERROR'); + } + complete: function(response) { + console.log('reboot call completed'); + + } + }); + } }); });