Get path and query string from URL using javascript -
i have this:
http://127.0.0.1:8000/found-locations/?state=--&km=km
i want this:
found-locations/?state=--&km=km
how do in javascript?
i tried window.location.href
giving me whole url
tried window.location.pathname.substr(1)
giving me found-locations/
use location.pathname
, location.search
:
(location.pathname+location.search).substr(1)
Comments
Post a Comment