DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
JavaScript GetVars Array
Figure out which Get-Vars are defined using client side javascript regex:
function getvars(s){
// php preg_match would be as easy as: (/([^&?=])=[^&?=]/g)
a = s.match(/[^&?=]*=[^&?=]*/g);
r = new Array();
for (i=0; i<a.length; i++) {
r[i] = a[i].match(/[^&?=]*/)[0];
}
return(r);
}
/* test */
alert(getvars(window.location.search));





