Created
November 14, 2014 21:30
-
-
Save stuntbox/d492e358f751598ca32b to your computer and use it in GitHub Desktop.
Revisions
-
stuntbox created this gist
Nov 14, 2014 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ /*- Query String Values ------------------------------------------------------*/ // // Retrieves, parses URL query string values into an object using JS. // See "JavaScript: The Definitive Guide", 5th ed, p.272, example 14-1. var queryStringValues = getQueryStringValues(); function getQueryStringValues() { // var args = new Object(); var args = {}; var query = location.search.substring(1); var pairs = query.split("&"); for (var i = 0; i < pairs.length; i++) { var pos = pairs[i].indexOf("="); if (pos == -1) continue; var argName = pairs[i].substring(0, pos); var value = pairs[i].substring(pos + 1); value = decodeURIComponent(value); args[argName] = value; } return args; }