Back
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&number=0
To get current URL with jQuery and its path, you can use the below-mentioned code:-
var pathname = window.location.pathname; var url = window.location.href;var origin = window.location.origin;
var pathname = window.location.pathname;
var url = window.location.href;
var origin = window.location.origin;
31k questions
32.8k answers
501 comments
693 users