1function GetUrlParameter(sParam)
2
3{
4 var sPageURL = window.location.search.substring(1);
5
6 var sURLVariables = sPageURL.split('&');
7
8 for (var i = 0; i < sURLVariables.length; i++)
9 {
10 var sParameterName = sURLVariables[i].split('=');
11
12 if (sParameterName[0] == sParam)
13
14 {
15 return sParameterName[1];
16 }
17 }
18}
19
20And this is how you can use this function assuming the URL is,
21http://dummy.com/?technology=jquery&blog=jquerybyexample.
22
23var tech = GetUrlParameter('technology');
24var blog = GetUrlParameter('blog');
1var getUrlParameter = function getUrlParameter(sParam) {
2 var sPageURL = window.location.search.substring(1),
3 sURLVariables = sPageURL.split('&'),
4 sParameterName,
5 i;
6
7 for (i = 0; i < sURLVariables.length; i++) {
8 sParameterName = sURLVariables[i].split('=');
9
10 if (sParameterName[0] === sParam) {
11 return typeof sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
12 }
13 }
14 return false;
15};
16And this is how you can use this function assuming the URL is,
17http://dummy.com/?technology=jquery&blog=jquerybyexample.
18
19var tech = getUrlParameter('technology');
20var blog = getUrlParameter('blog');
1var getUrlParameter = function getUrlParameter(sParam) {
2 var sPageURL = window.location.search.substring(1),
3 sURLVariables = sPageURL.split('&'),
4 sParameterName,
5 i;
6
7 for (i = 0; i < sURLVariables.length; i++) {
8 sParameterName = sURLVariables[i].split('=');
9
10 if (sParameterName[0] === sParam) {
11 return typeof sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
12 }
13 }
14 return false;
15};
16