Tuesday, September 4, 2012

Get QueryString value using JQuery


//Code Starts
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];
        }
    }
}​
//Code Ends

//
 var tech = GetQueryStringParams('technology');
 var blog = GetQueryStringParams('blog');
 //

No comments:

Post a Comment