Commit e14c19f8 authored by Klint Youngmeyer's avatar Klint Youngmeyer
Browse files

Add function to get switch state

parent ecee01c6
......@@ -64,6 +64,18 @@ Send questions to <a href="mailto:supporrt@emacinc.com">support@emacinc.com</a>.
action: 'toggle'
}));
};
function getSwitch() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "/get_switch", true);
xhr.onreadystatechange = function() {
if (this.readyState == XMLHttpRequest.DONE && this.status == 200) {
var data = xhr.responseText;
var jsonResponse = JSON.parse(data);
document.getElementById("switchMsg").innerHTML = jsonResponse['status'];
}
}
xhr.send();
};
</script>
</body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment