Reputation: 113
I would like to get this information from url with jQuery:
login
from this url:
http://www.domain.com/index.html#login
So what i would like, is to get the information from # and later use the information that i got from # to make an include. I know how to include a file, but i don't know how to get the information from the url, and from "#"
I don't really want to use &site=login, because it's my last option.
Upvotes: 2
Views: 171
Reputation: 35256
With jQuery
var loc = $(window)[0].location;
var thingYouWant = $(loc).prop('hash').substr(1);
Upvotes: 0
Reputation: 5231
The window.location
object has a hash
property.
console.log(window.location.hash);
Break up the values, if there are multiple with:
window.location.hash.split('#');
Upvotes: 0