Skip to content

Instantly share code, notes, and snippets.

@Reedyseth
Last active April 29, 2016 18:18
Show Gist options
  • Save Reedyseth/b9ca0e73abe2f7fa5f5febb3f5535cef to your computer and use it in GitHub Desktop.
Save Reedyseth/b9ca0e73abe2f7fa5f5febb3f5535cef to your computer and use it in GitHub Desktop.
/**
* This will parse a given URL into an Object.
* @author Reedyseth
*
* @param qs String The URL to be parse.
* @return elements Object With the variables and the values.
**/
function parseQueryString(qs) {
var elements = {};
var a = qs.split("&");
var size = a.length;
var b;
for (var i = 0; i < size; i++) {
b = a[i].split("=");
elements[ b[0] ] = decodeURIComponent( b[1] );
}
return elements;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment