Created
September 27, 2016 15:06
-
-
Save PaluMacil/12267255ba8c337e1b5ae90c439ce5cd to your computer and use it in GitHub Desktop.
This is how JQuery passes an array in a GET request.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This is how JQuery passes arrays in a GET request | |
var tdata = { one: 1, two: 2, three: ["a", "b", "c"]}; | |
$.get("/test", tdata, function (data) { console.log("All done!"); }); | |
//http://example.com/test?one=1&two=2&three%5B%5D=a&three%5B%5D=b&three%5B%5D=c | |
/*Broken down... | |
http:// | |
example.com/ | |
test? | |
one=1 & | |
two=2 & | |
three %5B%5D=a & | |
three %5B%5D=b & | |
three %5B%5D=c | |
%5B%5D decodes to [] | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment