Skip to content

Instantly share code, notes, and snippets.

@russianryebread
Last active August 29, 2015 14:17
Show Gist options
  • Save russianryebread/f11c6518988aeef8ad9c to your computer and use it in GitHub Desktop.
Save russianryebread/f11c6518988aeef8ad9c to your computer and use it in GitHub Desktop.
Parses the URL Query String in Javascript
function getQueryVariable(qvar) {
var query = window.location.search.substring(1);
var vars = query.split("&");
var len = vars.length;
for (var i=0;i<len;i++) {
var kv = vars[i].split("=");
if(kv[0] == qvar){return kv[1];}
}
return(false);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment