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

Popular posts from this blog

c++ - Function signature as a function template parameter -

How to call a javascript function after the page loads with a chrome extension? -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -