Hi folks
I have a URL that looks like http://mysite.com/#id/Blah-blah-blah
, it's used for Ajax-ey bits. I want to use substring()
or substr()
to get the id
part. ID
could be any combination of any length of letters and numbers.
So far I have got:
var hash = window.location.hash;
alert(hash.substring(1)); // remove #
Which removes the front hash, but I'm not a JS coder and I'm struggling a bit. How can I remove all of it except the id
part? I don't want anything after and including the final slash either (/Blah-blah-blah
).
Thanks!
Jack