0

I know there are other questions on this but none seem to work with arrays. I've been going at this for awhile now and I think I'm really overcomplicating things.

Lets say we are taking the following address: http://example.com/?i[]=22&i[]=100&j=a

I want to create a function that I could run similar to this:

getParameter('i');

Which would return [22,100]

Or I could run:

getParameter('j');

Which would return a string value of 'a'.

  • I don't see this as a duplicate. If I get this correctly, user wants to construct an array of values from repeated (and strangly formatted) vars in the URL query. Linked question just returns the first one. – Mirko Vukušić Apr 20 '17 at 21:33
  • Cant write an answer while this is marked as duplicate but I think this is what is expected: https://jsfiddle.net/4jz0oj9y/ – Mirko Vukušić Apr 20 '17 at 21:36

0 Answers0