Anders and Briegel in Python
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
490B

  1. var body;
  2. function poll() {
  3. var xhr = new XMLHttpRequest();
  4. xhr.onload=function() {
  5. soft_console.innerHTML = "\n" + xhr.responseText;
  6. };
  7. xhr.onerror = function(e){
  8. soft_console.innerHTML = "\n" + "Lost connection to server";
  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. }