blob: e1288203a726a3e0842dd8efdffcf8dba643a574 [file] [log] [blame]
Nils Diewald33ccfb02015-01-21 20:17:23 +00001// TODO: https://github.com/honza/140medley/blob/master/140medley.js
2
Nils Diewalde99d9042014-11-20 23:36:54 +00003"use strict";
4
5// https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest
6// https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest
7// r.addEventListener("progress", updateProgress, false);
Nils Diewald996aa552014-12-02 03:26:44 +00008// http://www.javascriptkit.com/javatutors/loadjavascriptcss.shtml
9// http://stackoverflow.com/questions/6112744/load-javascript-on-demand
Nils Diewalde99d9042014-11-20 23:36:54 +000010var Ajax = {
11 getJSON : function (url, onload) {
12 var r = new XMLHttpRequest();
13 r.open('GET', url, true);
14 r.setRequestHeader("Accept", "application/json");
15 r.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
16 r.onreadystatechange = function () {
17 if (this.readyState == 4)
18 onload(JSON.parse(this.responseText));
19 };
20 r.send();
21 }
22};
23