I've a url similat to example.com/?id[]=15029&id[]=18711&foo=bar#MyTab
I want to get all the id's in the url
var str = window.location.search;
var result = {};
str.replace(/([^?=&]+)(?:[&#]|=([^&#]*))/g, function (match, key, value) {
result[key] = value || 1;
});
result;
Above code only returns the last id paramenter.
How can I improve it to get all ids in an array?