javascript - Getting the url parameters inside the html page -


i have html page loaded using url looks little this:

http://localhost:8080/gisproject/mainservice?s=c&o=1 

i obtain parameters in url without using jsp.can done using javascript or jquery.i want test page using node.js local server before deploying in remote machine uses java server.

is there library allow me that.

a nice solution given here:

function geturlparameter(sparam) {     var spageurl = window.location.search.substring(1);     var surlvariables = spageurl.split('&');     (var = 0; < surlvariables.length; i++)      {         var sparametername = surlvariables[i].split('=');         if (sparametername[0] == sparam)          {             return sparametername[1];         }     } }​ 

and how can use function assuming url is, http://dummy.com/?technology=jquery&blog=jquerybyexample:

var tech = geturlparameter('technology'); var blog = geturlparameter('blog');` 

Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -