Description:
In this example we explain that how to get Query String parameter using jQuery. Or how can I get parameter value from Query String using JQuery. Or get query string parameter with jQuery. Or get URL parameter or get query string value using jQuery.
So here
we demonstrate that how to get URL parameter or Query string parameter value at
client side using jQuery. Below is the function that will return the parameter
value using jQuery.
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];
}
}
}
How to Call:
Suppose URL is “http://aspsolutionkirit.blogspot.in/?technology=jquery&blog=jquerybyexample".
So in above code
variable " technology " will have “jquery" as value and "blog" variable's
will be "jquerybyexample".
var tech = GetURLParameter('technology');
var blog = GetURLParameter('blog');
0 comments:
Post a Comment