webmcp
changeset 54:89030e955845
Changed partialload_encodeFormData(...) to allow non-string objects implementing .toString()
author | jbe |
---|---|
date | Tue Sep 06 21:05:11 2011 +0200 (2011-09-06) |
parents | a1c77838c2e5 |
children | 594a85118cb7 |
files | framework/js/partialload.js |
line diff
1.1 --- a/framework/js/partialload.js Fri Jun 10 15:32:29 2011 +0200 1.2 +++ b/framework/js/partialload.js Tue Sep 06 21:05:11 2011 +0200 1.3 @@ -23,15 +23,15 @@ 1.4 var result = ""; 1.5 for (var key in params) { 1.6 var value = params[key]; 1.7 - if (typeof(value) == "string") { 1.8 - if (result != "") result += "&"; 1.9 - result += encodeURIComponent(key) + "=" + encodeURIComponent(value); 1.10 - } else if (typeof(value) == "object") { 1.11 + if (value instanceof Array) { 1.12 var i; 1.13 for (i=0; i<value.length; i++) { 1.14 if (result != "") result += "&"; 1.15 - result += encodeURIComponent(key) + "=" + encodeURIComponent(value[i]); 1.16 + result += encodeURIComponent(key) + "=" + encodeURIComponent(value[i].toString()); 1.17 } 1.18 + } else { 1.19 + if (result != "") result += "&"; 1.20 + result += encodeURIComponent(key) + "=" + encodeURIComponent(value.toString()); 1.21 } 1.22 } 1.23 return result;