diff --git a/core-xhr.html b/core-xhr.html index 8557aec..058da39 100644 --- a/core-xhr.html +++ b/core-xhr.html @@ -71,21 +71,29 @@ } return xhr; }, - + toQueryString: function(params) { var r = []; for (var n in params) { var v = params[n]; n = encodeURIComponent(n); - r.push(v == null ? n : (n + '=' + encodeURIComponent(v))); + if(v == null){ + r.push(n); + }else{ + v = this.isString(v) ? v : JSON.stringify(v); + r.push(n + '=' + encodeURIComponent(v)); + } } return r.join('&'); }, - + isString:function(str){ + return str instanceof String || + typeof str === 'string'; + }, isBodyMethod: function(method) { return this.bodyMethods[(method || '').toUpperCase()]; }, - + bodyMethods: { POST: 1, PUT: 1, @@ -111,5 +119,5 @@ }); - + diff --git a/tests/html/core-ajax-arrays.html b/tests/html/core-ajax-arrays.html new file mode 100644 index 0000000..104d1c1 --- /dev/null +++ b/tests/html/core-ajax-arrays.html @@ -0,0 +1,47 @@ + + + +
+