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
491B

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