Skip to content

Instantly share code, notes, and snippets.

@monkianer
Last active August 29, 2015 14:25
Show Gist options
  • Save monkianer/14b27cf95605799e2b42 to your computer and use it in GitHub Desktop.
Save monkianer/14b27cf95605799e2b42 to your computer and use it in GitHub Desktop.
/** Get parameter after query(ex:?p=1) sign.
* @param {string} parameter name.
*/
var GetURLParameter = function(sParam){
var oPageURL = window.location.href;
var sPageURL = oPageURL.split('?')[1];
if(sPageURL == null){
return;
}
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