blob: 2af0bc074f137b6dc403c535991b1977718ea7fc [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);
6var Ajax = {
7 getJSON : function (url, onload) {
8 var r = new XMLHttpRequest();
9 r.open('GET', url, true);
10 r.setRequestHeader("Accept", "application/json");
11 r.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
12 r.onreadystatechange = function () {
13 if (this.readyState == 4)
14 onload(JSON.parse(this.responseText));
15 };
16 r.send();
17 }
18};
19