I am using jQuery. How do I get the path of the current URL and assign it to a variable?
Example URL:
http://localhost/menuname.de?foo=bar&nu
You can simply get your path using js itself, window.location or location will give you the object of current URL
window.location
location
console.log("Origin - ",location.origin); console.log("Entire URL - ",location.href); console.log("Path Beyond URL - ",location.pathname);