F
get: function (url, onresponse) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onreadystatechange = function () {
if (xhr.readyState != 4) return;
onresponse(xhr.response, xhr.status, xhr.statusText);
};
xhr.send();
},
post: function (url, postparams, onresponse) {
var xhr = new XMLHttpRequest();
xhr.open('POST', url, true);
xhr.onreadystatechange = function () {
if (xhr.readyState != 4) return;
onresponse(xhr.response, xhr.status, xhr.statusText);
};
var data = new FormData();
for (var prop in postparams) {
data.append(prop, postparams[prop]);
}
xhr.send(data);
}
};