[Pas2js] JS Sync/Async Limitations

cbsistem cbsistem at yahoo.com.br
Sat Feb 23 17:22:44 CET 2019


https://developer.mozilla.org/pt-BR/docs/Web/API/XMLHttpRequest/send
https://developer.mozilla.org/pt-BR/docs/Web/API/XMLHttpRequest/open

 var xhr;
    if (!xhr) {
      try { xhr = new XMLHttpRequest;
      } catch(e) {};
    };
    if (!xhr) {
      try { xhr = new ActiveXObject("Msxml2.XMLHTTP.6.0");
      } catch(e) {};
    };
    if (!xhr) {
      try { xhr = new ActiveXObject("Msxml2.XMLHTTP.3.0");
      } catch(e) {};
    };
    if (!xhr) {
      try { xhr = new ActiveXObject("Msxml2.XMLHTTP");
      } catch(e) {};
    };
    if (!xhr) {
      try { xhr = new ActiveXObject("Microsoft.XMLHTTP");
      } catch(e) {};
    };
    if (!xhr) {
      console.log( "No XHR support");
      return;
    };
    xhr.onreadystatechange = function() {
      if (xhr.readyState != 4) {
        return;
      };
      if (xhr.status != 200) {
       //CallBackFunction(item, false, "Response code is " +
xhr.status.toString());
        return;
      };
      //CallBackFunction(item, true, xhr.responseText);
    };
    xhr.open(i"GET" or "POST", URL, false OR true);  // true to sync (
waiting)
    xhr.send(JSON);





-----
Cristiano Barbosa
--
Sent from: http://pas2js.38893.n8.nabble.com/


More information about the Pas2js mailing list