Skip to content

Instantly share code, notes, and snippets.

@djcommandline
djcommandline / gist:5111846
Last active December 14, 2015 15:59
JS :: Query String Parser
var QueryString = function () {
// This function is anonymous, is executed immediately and
// the return value is assigned to QueryString!
var query_string = {};
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
// If first entry with this name
if (typeof query_string[pair[0]] === "undefined") {