How to get URL & Querystring Value Using jQuery
In this tutorial i will let you know guys, How to get URL & Querystring Value Using jQuery.This is very useful when we have to process a request by querystring value.
Example:
URL = http://www.hightechnology.in/project.aspx?projectid=1
Read Querystring Value:
function GetQueryStringParams(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];
}
}
}?
var projid = GetQueryStringParams('projectid');
Result:
projid=1
