Skip to content

Instantly share code, notes, and snippets.

@NdYAG
Created March 6, 2013 08:35
Show Gist options
  • Save NdYAG/5097668 to your computer and use it in GitHub Desktop.
Save NdYAG/5097668 to your computer and use it in GitHub Desktop.
parse document.location.search to obj
$.unparam = function(search) {
var queries = search.split('&')
var retObj = {}
$(queries).each(function(index, query) {
var match = query.match(/([^?&]*)=([^&]*)/i)
if(match) {
retObj[match[1]] = match[2]
}
})
return retObj
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment