Created
March 6, 2013 08:35
-
-
Save NdYAG/5097668 to your computer and use it in GitHub Desktop.
parse document.location.search to obj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.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