Anders and Briegel in Python
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
452B

  1. function poll() {
  2. console.log("polling");
  3. var xhr = new XMLHttpRequest();
  4. xhr.load=function() {
  5. console.log(JSON.parse(xhr.responseText));
  6. };
  7. xhr.onerror = function(e){
  8. console.log(e);
  9. };
  10. xhr.open("GET", "/state", true);
  11. xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
  12. xhr.send();
  13. }
  14. window.onload = function () {
  15. console.log("booting");
  16. setInterval(poll, 1000);
  17. }