« Blog Home

§ Handling url get string with javascript

Using javascript to handle url get string variables

This will find the value of a get variable and return it.  If it is not found it returns false.

 


function getGetValue(getName) {
  var getString = window.location.search.substring(1);
  var getArray = getString.split("&");
  var getNameValue;
  for(var i=0;i<getArray.length;i++) {
    getNameValue = getArray[i].split("=");
    if(getNameValue[0]==getName)
      return getNameValue[1];
  }
  return false;
}
 

 

last edited on February 14th, 2009 at 12:21 AM

Comments

No Comments Here. Add yours below!

Add your comment

Name:
Email: (Will not be displayed - Privacy policy)
Website:
Comments:
  random image I can't read it!
Give me a different one!
Verify Post: Input the text from the image above to verify this post (helps prevent spam)
 

« Blog Home


The abbot shook his head.  “Michael and the others went too far when they went to the Kaiser.  It is not for us to order the affairs of kings, but to care for the poor and lowly.”
“That,” said Dietrich, “may require you to order the affairs of kings.”
an abbot & Dietrich, Eifelheim, Michael Flynn