html - Getting the part of string from the URL using jQuery? -


this question has answer here:

i have following url in browser address bar

http://localhost:8080/myapp/myscreen?username=ccc 

i need part /myscreen?username=ccc it, excluding root.

how can using jquery?

var = location.pathname + location.search 

if reason want hash (the # part of url), use instead:

var = location.pathname + location.search + location.hash 

then, must remove app root path a:

a = a.replace( "/myapp/", "" ); // or = a.substring( "/myapp/".length ); 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -