Advertisement
WolfLarsen33

tph 2

Jan 6th, 2024
690
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function getParamData() {
  2.   var xhr = new XMLHttpRequest();
  3.   xhr.timeout = 2000;
  4.   xhr.ontimeout = function() {
  5.     console.log("TimeOut getParamData");
  6.     gId("xerror").innerHTML="TimeOut getParamData"
  7.   };
  8.   xhr.onreadystatechange = function() {
  9.     if (this.readyState == 4 && this.status == 200) {
  10. //console.log(this.responseText);
  11.       var index = 0;
  12.       var tb=this.responseText.split(";");
  13.       gId("tp1").value = tb[index++];
  14.       gId("tp2").value = tb[index++];
  15.       gId("tp3").value = tb[index++];
  16.     }
  17.   };
  18.   xhr.open("GET", "getParamData", true);
  19.   xhr.send();
  20. }
  21. function gId(id) {
  22.   return document.getElementById(id);
  23. }
  24. getParamData();
  25.  
Tags: tph
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement