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