How to use the xmlhttprequest.XMLHttpRequest function in xmlhttprequest

To help you get started, we’ve selected a few xmlhttprequest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OmarElGabry / Hashtegny / node_modules / codebird / codebird.js View on Github external
} catch (e) {
                console.error("ActiveXObject object not defined.");
            }
        // now, consider RequireJS and/or Node.js objects
        } else if (typeof require === "function"
            && require
        ) {
            // look for xmlhttprequest module
            try {
                var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
                xml = new XMLHttpRequest();
            } catch (e1) {
                // or maybe the user is using xhr2
                try {
                    var XMLHttpRequest = require("xhr2");
                    xml = new XMLHttpRequest();
                } catch (e2) {
                    console.error("xhr2 object not defined, cancelling.");
                }
            }
        }
        return xml;
    };
github CyberMiles / tim-research / reading_event_logs / code / nodeJsHtml / app / server.js View on Github external
function getRequestWithOnlyUrl(theUrl) {
    theRequest = new XMLHttpRequest();
    theUrl = theUrl;
    console.log("Checking URL: " + theUrl);
    theRequest.open('GET', theUrl, /* async = */ false);
    theRequest.send();
    if (theRequest.status >= 200 && theRequest.status < 300) {
        return theRequest.responseText;
    } else {
        console.log(theRequest.status);
    }
}
github blengerich / GenAMap / src / frontend / GDCdata / script / GetMarkerData.js View on Github external
function FPKMDownload(line){
    const FPKMPath = path.join(folderPath, 'FPKM')
    mkdirp.sync(FPKMPath)
    const UUID = line.split(' ')[1]
    const caseid = line.split(' ')[0]
    const filepath = path.join(FPKMPath, 'FPKM_'+caseid+'.csv')
    var options = null
    var link = 'https://gdc-api.nci.nih.gov/data/' + UUID
    var suffix
    var filename
    var client = new XMLHttpRequest()
    try{
    client.open("GET", link , true)
    client.send()
    client.onreadystatechange = function() {
      if(this.readyState == 4 && this.status == 200) {
        try{
          var markerStream = fs.createWriteStream(filepath, {'flags':'w'})
          var stream = request(link).pipe(zlib.createGunzip()).pipe(markerStream)
          stream.on('finish', function() {
              markerStream.end()
              FPKM_index = FPKM_index + 1
              console.log('F_'+FPKM_index)
              if(FPKM_index < FPKM_list.length){FPKMDownload(FPKM_list[FPKM_index])}
          })
        }
        catch(err){
github Esri / geoservices-js / lib / request.js View on Github external
function get (url, callback) {
  var httpRequest = new XMLHttpRequest();

  httpRequest.onreadystatechange = _requestHandler(callback);

  httpRequest.open("GET", url);
  _maybeSetReferer(httpRequest);
  httpRequest.send(null);
}
github jondubois / nombo / node_modules / socket.io-client / lib / util.js View on Github external
util.ua.hasCORS = 'undefined' != typeof XMLHttpRequest && (function () {
    try {
      var a = new XMLHttpRequest();
    } catch (e) {
      return false;
    }

    return a.withCredentials != undefined;
  })();
github eerotal / LibreSignage / src / node_modules / ls-api / api.js View on Github external
return new Promise((resolve, reject) => {
			let req = new XMLHttpRequest();
			let conf = {
				'ctype': null,
				'data': null,
				'url': `${this.config.host ? this.config.host + '/' : ''}`
						+ `${endpoint.uri}`
			};

			req.addEventListener("load", function() {
				let tmp = null;
				switch(this.getResponseHeader('Content-Type')) {
					case 'application/json':
						tmp = JSON.parse(this.responseText);
						if (tmp.error) {
							reject(new APIError(tmp));
						} else {
							resolve(tmp);
github Esri / geoservices-js / lib / request.js View on Github external
function post (url, data, callback) {
  var httpRequest = new XMLHttpRequest();

  httpRequest.onreadystatechange = _requestHandler(callback);

  httpRequest.open("POST", url);
  _maybeSetReferer(httpRequest);
  httpRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  httpRequest.send(stringify(data));
}
github twilio / twilio-video.js / lib / request.js View on Github external
return new Promise(function(resolve, reject) {
    if (typeof method !== 'string' || !params) {
      throw new Error('method and params are required args.');
    }

    var xhr = new XHR();
    xhr.open(method.toUpperCase(), params.url, true);
    xhr.withCredentials = !!params.withCredentials;

    xhr.onreadystatechange = function onreadystatechange() {
      if (xhr.readyState !== 4) { return; }

      if (200 <= xhr.status && xhr.status < 300) {
        resolve(xhr.responseText);
      } else {
        reject(xhr.responseText);
      }
    };

    for (var headerName in params.headers) {
      xhr.setRequestHeader(headerName, params.headers[headerName]);
    }
github PokemonGoers / PredictPokemon-2 / apiData_arff.js View on Github external
function httpGetAsync(url, destination, classKey) {
    var xmlHttp = new XMLHttpRequest();
    xmlHttp.onreadystatechange = function () {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            var apiData = JSON.parse(xmlHttp.responseText);
            jsonToArff(apiData, classKey, 'apiData', destination);
        }
    };
    xmlHttp.open("GET", url, true);
    xmlHttp.send();
    return xmlHttp.responseText;
}
github arbazsiddiqui / A-song-of-ice-and-fire-API / asoiaf.js View on Github external
var httpGet = function(url)
        {
            var xmlHttp = new XMLHttpRequest();
            xmlHttp.open("GET", url, false);
            xmlHttp.send(null);
            return JSON.parse(xmlHttp.responseText);
        }
    } else {

xmlhttprequest

XMLHttpRequest for Node

MIT
Latest version published 9 years ago

Package Health Score

69 / 100
Full package analysis