I have a url like http://www.example.com/folder/file.html#val=90&type="test"&set="none"&value="reset?setvalue=1&setvalue=45"
Now I need to get the portion of url from starting from #, How do I get that, I tried using window.location.search.substr();
but looks like that searches for ? in a url. is there a method to get the value of url after #
How do I also get a portion of url from ampersand &
Thanks, Michael
This will get the
#
and&
values:More info here: https://developer.mozilla.org/en/DOM/window.location
Update: This will grab all characters after the hashtag, including any query strings. From the MOZ manual:
Now, if you need to PARSE the query string, which I believe you do, check this out here: How can I get query string values in JavaScript?
To grab the hash:
To grab the query string
[EDIT - since you seem to have a sort query-string-esq string which is actually part of your hash, the following will retrieve and parse it into an object of name/value pairings.