I have an application need to parse the parameter from URL. But the URL got special character '#'.
URL: http://localhost:8080/test.html?parms=PESTL4#2
I printed the windows.location, and the result is "http://localhost:8080/test.html?parms=PESTL4#2".
I used the following sample code to get parms, and it returns PESTL4. How does it work?
function getQueryVariable(variable)
{
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){return pair[1];}
}
return(false);
}