Skip to content

Instantly share code, notes, and snippets.

@joshvermaire
Created June 27, 2012 00:17
Show Gist options
  • Select an option

  • Save joshvermaire/3000408 to your computer and use it in GitHub Desktop.

Select an option

Save joshvermaire/3000408 to your computer and use it in GitHub Desktop.
Parse a query String
getQueryVariable = (variable) ->
query = window.location.search.slice(1)
vars = query.split "&"
i = 0
while i < vars.length
pair = vars[i].split("=")
return unescape(pair[1]) if pair[0] is variable
i++
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment