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

Winapi c++: DialogBox hangs when breaking a loop -

vb.net - Font adding using PDFsharp -

javascript - jQuery iScroll clickable list elements while retaining scroll? -