How to get querystring value using jQuery

In this post, I will show you how to get the QueryString variable value using jQuery. I have created a function which returns value of any querystring variable.

Earlier I had posted about Get Page Title and URL using jQuery, Get previous page URL using jQuery, Check for '#' hash in URL using jQuery, Style Hyperlinks based on URL extension and Use protocol less URL for referencing jQuery.
function GetQueryStringParams(sParam)
    var sPageURL =;
    var sURLVariables = sPageURL.split('&');
    for (var i = 0; i < sURLVariables.length; i++) 
        var sParameterName = sURLVariables[i].split('=');
        if (sParameterName[0] == sParam) 
            return sParameterName[1];
And this is how you can use this function assuming the URL is,
var tech = GetQueryStringParams('technology');
var blog = GetQueryStringParams('blog');
Feel free to contact me for any help related to jQuery, I will gladly help you.

Nothing shocks me, I'm a Software Engineer. And I am not young enough to know everything. I live in World Wide Web and from there take care of this website. This website communicates about my work, learning and experience. I believe life is short, and it is for loving, sharing, learning and connecting. So lets connect..