Skip to content

Instantly share code, notes, and snippets.

@dharFr
Created January 13, 2012 14:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dharFr/1606525 to your computer and use it in GitHub Desktop.
Save dharFr/1606525 to your computer and use it in GitHub Desktop.
Simple CoffeeScript function to extracts parameters from URL
utils = utils || {}
utils.extractURLParams =->
params = window.location.search.substring(1).split "&"
result = {}
for param in params
strParam = param.toString()
sepPos = strParam.indexOf "="
key = strParam.substring 0, sepPos
value = decodeURIComponent strParam.substring (sepPos + 1)
result[key] = value
result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment