Answers for "aacces url query parameters in jquery"

8

jquery get parameter from url

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];
        }
    }
}

And this is how you can use this function assuming the URL is,
http://dummy.com/?technology=jquery&blog=jquerybyexample.

var tech = GetUrlParameter('technology');
var blog = GetUrlParameter('blog');
Posted by: Guest on June-30-2020

Code answers related to "aacces url query parameters in jquery"

Code answers related to "Javascript"

Browse Popular Code Answers by Language