From 0cde8603dac7e2e0c0565f582b756fda918848d9 Mon Sep 17 00:00:00 2001 From: Viktor Kojouharov Date: Fri, 29 Aug 2014 12:27:34 +0300 Subject: [PATCH 1/2] Treat array parameter values as miltivalue parameters --- core-xhr.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core-xhr.html b/core-xhr.html index 8557aec..967cb18 100644 --- a/core-xhr.html +++ b/core-xhr.html @@ -77,7 +77,13 @@ for (var n in params) { var v = params[n]; n = encodeURIComponent(n); - r.push(v == null ? n : (n + '=' + encodeURIComponent(v))); + if (Array.isArray(v)) { + v.forEach(function(val) { + r.push(val == null ? n : (n + '=' + encodeURIComponent(val))); + }); + } else { + r.push(v == null ? n : (n + '=' + encodeURIComponent(v))); + } } return r.join('&'); }, From 003e6d3f09af9c8006164294392a4c9f79625b23 Mon Sep 17 00:00:00 2001 From: Viktor Kojouharov Date: Sat, 1 Nov 2014 12:51:02 +0200 Subject: [PATCH 2/2] Add a test for multi-value parameters --- tests/html/core-ajax.html | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tests/html/core-ajax.html b/tests/html/core-ajax.html index 318d052..0c4fd27 100644 --- a/tests/html/core-ajax.html +++ b/tests/html/core-ajax.html @@ -11,7 +11,7 @@ core-ajax - + @@ -21,20 +21,35 @@ + +