Skip to content

Instantly share code, notes, and snippets.

@tkawachi
Created January 17, 2012 01:47
Show Gist options
  • Select an option

  • Save tkawachi/1624033 to your computer and use it in GitHub Desktop.

Select an option

Save tkawachi/1624033 to your computer and use it in GitHub Desktop.
getQueryVariable = (variable) ->
query = root.location.search.substring(1)
pairStrings = query.split('&')
for pairString in pairStrings
pair = pairString.split("=")
if pair[0] == variable
return unescape(pair[1])
console.log("WARN: #{variable} is not found in query string")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment