JSFiddle - React, Tailwind, and code Playground

by lottikarotti

JavaScript

/**
 * Simple XHR Object Factory
 * min.js: http://goo.gl/D1pKSQ
 *
 * usage:
 *  var xhr = createXHRobj();
 *  xhr.open('GET', 'http://example.org/data', true);
 *  xhr.send();
 */
(function(global){
    'use strict';
    var factory, Xhr=global.XMLHttpRequest, AXobj=global.ActiveXObject;
    if(typeof Xhr === 'function'){
        factory = function(){
            return new Xhr();
        };
    } else{
        try{
            factory = function(){
                return new AXobj
            }
    }
}(window));

var xhr = createXHRobj();
xhr.open('GET', '//google.de', true);
xhr.send();