better version of request (now we can add key-value-pairs to data via .setData())

This commit is contained in:
overflowerror 2014-08-08 17:06:40 +02:00
parent df0ecc611d
commit 4e6b5362ce

View file

@ -8,8 +8,8 @@ Request.prototype.type = "GET";
Request.prototype.file = "";
Request.prototype.data = "";
Request.prototype.setData = function(array) {
for (var i = 0; i < array; i++) {
this.data += (this.data.length == 0 ? "" : "&") + encodeURIComponent(array[i]);
for (var i = 0; i < array.length; i++) {
this.data += (this.data.length == 0 ? "" : "&") + encodeURIComponent(array[i][0]) + "=" + encodeURIComponent(array[i][1]);
}
}
Request.prototype.send = function(synchron, after) {