We are using jQuery. How do we get the path of the current URL and assign it to a variable?
To get the path, we can use:
In pure jQuery style:
The location object also has other properties, like host, hash, protocol, and pathname.
If we need the hash parameters present in the URL,
window.location.href may be a better choice.