Skip to content

Commit

Permalink
main.js Show error on fail
Browse files Browse the repository at this point in the history
  • Loading branch information
stokito committed Mar 15, 2021
1 parent ecf0100 commit dd375af
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit dd375af

Please sign in to comment.