cyrilleinvalides/choupas/www/admin/editor/scripts/xhrprocess.js

58 lines
972 B
JavaScript
Executable File

function xhrQuery(method, url) {
this.method = method;
this.url = url;
this.headers = new Array();
this.post = new Array();
this.async = true;
this.callback = null;
this.setHeader = function (header, value) {
var a = new Array();
a['name'] = header;
a['value'] = value;
this.headers[this.headers.length] = a;
return a;
}
this.setCallback = function (fn) {
this.callback = function (xhr) { fn(xhr); };
return true;
}
this.onError = function (status, statusText) {
alert(status + " : " + statusText);
}
this.addPost = function (name, value) {
if (typeof name == 'array' && typeof value == 'array') {
for (var i in name) this.addPost(name[i], value[i]);
return true;
}
var a = array();
a['name'] = name;
a['value'] = value;
this.post[this.post.length] = a;
return a;
}
this.reset = function (data) {
this[data] = new Array();
}
}
function process() {
this.doit = function (query) {
}
}