I have this:
http://127.0.0.1:8000/found-locations/?state=--&km=km
I want this:
found-locations/?state=--&km=km
how do i do this in javascript?
I tried window.location.href
but it is giving me whole url
I tried window.location.pathname.substr(1)
but it is giving me found-locations/
Use
location.pathname
andlocation.search
:URI.js is a nice JavaScript library for parsing URIs. It can do what you requested with a nice fluent syntax.
Will get you the base url
/found-locations
plus the query string?state=--&km=km