//Example website URL
"http://yoursite.com/?language=php&blog=techtalk".
//Create function which returns value of any parameters variable
function GetURLParameter(sParam) {
var sPageURL = window.location.search.substring(1),
sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++) {
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam) {
return sParameterName[1];
}
}
}
//variable
var lang = GetURLParameter('php');
var blog = GetURLParameter('techtalk');
//Above variable will output:
// --> 'lang' variable = 'php' value
// --> 'blog' variable = 'techtalk' value