I attempted to extract a list of names from a URL as URL parameters.
var url_arrays = [],url_param;
var url = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for (var i = 0; i < url.length; i++)
{
url_param = url[i].split('=');
url_arrays.push(url_param[0]);
url_arrays[url_param[0]] = url_param[1];
}
var temp = decodeURIComponent(url_arrays[2]).split(','||' ');
However, the output I am receiving looks like this:
[jon
Ned
Brian
Sam]
Is there a way to remove the opening and closing brackets?
The javascript replace
method can be used for replacement, but replacing a set of characters like str.replace('['||']','')
isn't possible with it.