“http Get Anfrage JS” Code-Antworten

HTTP -Anforderung in JavaScript

function httpGet(theUrl)
{
    var xmlHttp = new XMLHttpRequest();
    xmlHttp.open( "GET", theUrl, false ); // false for synchronous request
    xmlHttp.send( null );
    return xmlHttp.responseText;
}
Jittery Jackal

http Get Anfrage JS

function httpGetAsync(theUrl, callback)
{
    var xmlHttp = new XMLHttpRequest();
    xmlHttp.onreadystatechange = function() { 
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
            callback(xmlHttp.responseText);
    }
    xmlHttp.open("GET", theUrl, true); // true for asynchronous 
    xmlHttp.send(null);
}
Loulou.

HTTP -Anfrage JavaScript

const requests = new XMLHTTPRequest();

requests.open('METHOD', url)
requests.send()

requests.onload = () => {
 if (requests.status == 200) {
   console.log('ok')
 } else {
 console.log('didnt work')
 }
}
Yawning Yacare

HTTP -Anfrage JavaScript

function httpGetAsync(url, callback) {
  var xmlHttp = new XMLHttpRequest();
  xmlHttp.onreadystatechange = function() { 
    if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
      callback(xmlHttp.responseText);
  }
  xmlHttp.open("GET", url, true); // true for asynchronous 
  xmlHttp.send(null);
}
TC5550

Ähnliche Antworten wie “http Get Anfrage JS”

Fragen ähnlich wie “http Get Anfrage JS”

Weitere verwandte Antworten zu “http Get Anfrage JS” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen