From dd375af6a6b51f0cf27e823271adabf6f160cf84 Mon Sep 17 00:00:00 2001 From: Sergey Ponomarev Date: Tue, 16 Mar 2021 00:43:55 +0200 Subject: [PATCH] main.js Show error on fail --- js/main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/main.js b/js/main.js index 40354d2..f1907ba 100644 --- a/js/main.js +++ b/js/main.js @@ -4,7 +4,7 @@ $(document).ready( function() { // get the list of switches to poll var switchesJSON = $ .ajax( { url: 'switches.json', cache: false, dataType: 'json' } ) - .fail( function(e, textStatus ) { + .fail( function( e, textStatus ) { alert( 'Cannot find any switches: ' + textStatus ); }) .done( function( data ) { @@ -47,9 +47,9 @@ function UpdateSwitchData( id ) { var switchinfoJSON = $ .ajax( { url: 'http://' + ip + '/cgi-bin/json.cgi', cache: false, dataType: 'jsonp' } ) - .fail( function() { + .fail( function( e, textStatus ) { $('#imgSignal-' + id).attr( 'src', 'images/wifi_a2.png' ); - alert( 'Cannot contact' ); + alert( 'Unable to connect: ' + textStatus ); }) .done( function( data ) { // enable switch //add the data from the device to the array