Skip to content

Instantly share code, notes, and snippets.

@isouzasoares
Created January 14, 2014 12:43
Show Gist options
  • Save isouzasoares/8417724 to your computer and use it in GitHub Desktop.
Save isouzasoares/8417724 to your computer and use it in GitHub Desktop.
if( typeof utils == 'undefined' ) {
var utils = {};
}
utils.request = {
get : function(param) {
if(document.location.search.length == 0)
return {};
var tmp = {};
var params = document.location.search;
params = params.slice(1);
params = params.split('&');
for(var i = 0, ti = params.length; i < ti; i++)
{
params[i] = params[i].split('=');
tmp[decodeURIComponent(params[i][0])] = decodeURIComponent(params[i][1]);
}
return param ? tmp[param] : tmp;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment