I am busy writing a web page for a company. I need to accomplish the following: If the output is nothing, alert "Rookswitch is turned off"
. If the output is "Hookswitch-Playlist"
, alert "Rookswitch is turned on"
.
The data is grabbed from a REST API.
$(document).ready(function() {
$.ajax({
type: "GET",
url: "http://192.168.0.15:8080/Cnario/REST/GetDevice?deviceName=Rook-Switch",
dataType: "json",
processdata: true,
success: function(response) {
alert("De Rookswitch staat al aan");
if (response.GetDeviceResult.DevicePins.PinValue == 'Playlist-Roken')
handleSuccess(response);
else
handleError(response);
},
error: function(message) {
alert("Rookswitch is uit");
}
});
});
For some reason, the message is always on. even if it is off. How can i fix this?