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.

24 lines
515B

  1. var body;
  2. var state;
  3. function poll() {
  4. var xhr = new XMLHttpRequest();
  5. xhr.onload=function() {
  6. state = JSON.parse(xhr.response);
  7. soft_console.innerHTML = "\n" + xhr.responseText;
  8. };
  9. xhr.onerror = function(e){
  10. soft_console.innerHTML = "\n" + "Lost connection to server";
  11. };
  12. xhr.open("GET", "/state", true);
  13. xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
  14. xhr.send();
  15. }
  16. window.onload = function () {
  17. setInterval(poll, 1000);
  18. }