Skip to content

Instantly share code, notes, and snippets.

@muriloazevedo
Created July 13, 2015 15:34
Show Gist options
  • Save muriloazevedo/2455507dd783bf451537 to your computer and use it in GitHub Desktop.
Save muriloazevedo/2455507dd783bf451537 to your computer and use it in GitHub Desktop.
pega o valor de um parâmetro da querystring via js
function getUrlParameter(sParam)
{
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++)
{
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam)
{
return sParameterName[1];
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment