jquery get query string parameter – How to get querystring from URL using jQuery?

jquery get query string parameter – Get query string parameters url values with jQuery / Javascript (querystring) using console.log(window.location.search);

jquery get query string parameter

jquery read query string

get query string in jquery

function getUrlVars()
{
    var products = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        products.push(hash[0]);
        products[hash[0]] = hash[1];
    }
    return products;
}

Don't Miss : Get Query String Parameters From URL Using JQuery

jquery get url parameter

jquery get parameter from url

function GetUrlParameter(dynamicData)

{
    var getUrlData = window.location.search.substring(1);

    var webPageLiveURLNew = getUrlData.split('&');

    for (var i = 0; i < webPageLiveURLNew.length; i++)
    {
        var getArgumentNm = webPageLiveURLNew[i].split('=');

        if (getArgumentNm[0] == dynamicData)

        {
            return getArgumentNm[1];
        }
    }
}

And this is how you can use this function assuming the URL is,
http://domain-name.com/?programming=jquery&article=laraveldemo.

var tech = GetUrlParameter('programming');
var article = GetUrlParameter('article');

jquery get url

var currentURL = $(location).attr('href'); 
var currentURL = window.location.href;

jquery get parameter from url

function getUrlParameter(name, url) {
    if (!url) {
        url = window.location.href;
    }
    name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
    var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
    var results = regex.exec(url);
    return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
}


//url = domain_name.com?techonology=software&article=seobacklink
var tech = getUrlParameter('programming');
var article = getUrlParameter('article');

how to get url parameter using jquery or plain javascript?

var getUrlParameter = function getUrlParameter(dynamicData) {
    var getUrlData = window.location.search.substring(1),
        webPageLiveURLNew = getUrlData.split('&'),
        getArgumentNm,
        i;

    for (i = 0; i < webPageLiveURLNew.length; i++) {
        getArgumentNm = webPageLiveURLNew[i].split('=');

        if (getArgumentNm[0] === dynamicData) {
            return typeof getArgumentNm[1] === undefined ? true : decodeURIComponent(getArgumentNm[1]);
        }
    }
    return false;
};
And this is how you can use this function assuming the URL is,
http://domain-name.com/?programming=jquery&article=laraveldemo.

var tech = getUrlParameter('programming');
var article = getUrlParameter('article');

get param from url jquery

var getUrlParameter = function getUrlParameter(dynamicData) {
    var getUrlData = window.location.search.substring(1),
        webPageLiveURLNew = getUrlData.split('&'),
        getArgumentNm,
        i;

    for (i = 0; i < webPageLiveURLNew.length; i++) {
        getArgumentNm = webPageLiveURLNew[i].split('=');

        if (getArgumentNm[0] === dynamicData) {
            return typeof getArgumentNm[1] === undefined ? true : decodeURIComponent(getArgumentNm[1]);
        }
    }
    return false;
};

I hope you get an idea about jquery get query string parameter.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment