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.

20 line
391B

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