JSFiddle - React, Tailwind, and code Playground

by Maxim Ivanov

JavaScript

var DataLoader = { // fix
	load: function(url, callback, method) {
		var xhr = new XMLHttpRequest;
		xhr.open(method || 'GET', url); 
		xhr.send();
		xhr.onload = callback;
    }
};

function show_data(evt) {
  var xhr = evt.target;
  document.body.innerHTML += '<hr><pre>'+xhr.response.length+'</pre<br>';
};

DataLoader.load('https://api.github.com/users/o0/repos', show_data);
DataLoader.load('https://api.github.com/repositories', show_data);