I am trying to get the id from an url that looks like this '#somepage?id=5' the function I am using for this doesn't seem to work the function in question is:
function getParam(name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.href);
if (results == null)
return "";
else
return results[1];
}
is there a way I can modify or replace this function to pull the id from a url as stated above?