Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

get parameter from url using jquery

var getUrlParameter = function getUrlParameter(sParam) {
    var sPageURL = window.location.search.substring(1),
        sURLVariables = sPageURL.split('&'),
        sParameterName,
        i;

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

        if (sParameterName[0] === sParam) {
            return typeof sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
        }
    }
    return false;
};
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');
Comment

get param from url jquery

var getUrlParameter = function getUrlParameter(sParam) {
    var sPageURL = window.location.search.substring(1),
        sURLVariables = sPageURL.split('&'),
        sParameterName,
        i;

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

        if (sParameterName[0] === sParam) {
            return typeof sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
        }
    }
    return false;
};
Comment

jquery get parameter from url

 
(function($) {
    $.QueryString = (function(a) {
        if (a == "") return {};
        var b = {};
        for (var i = 0; i < a.length; ++i)
        {
            var p=a[i].split('=');
            if (p.length != 2) continue;
            b[p[0]] = decodeURIComponent(p[1].replace(/+/g, " "));
        }
        return b;
    })(window.location.search.substr(1).split('&'))
})(jQuery);
 
// Usage
var param = jQuery.QueryString["param"];
Comment

PREVIOUS NEXT
Code Example
Javascript :: string splice 
Javascript :: javascript date to html date input 
Javascript :: shuffle array 
Javascript :: decorators in javascript 
Javascript :: scroll up btn 
Javascript :: jsx example 
Javascript :: ?? in javascript 
Javascript :: angular custom directive 
Javascript :: Accessing user input through js 
Javascript :: javascript double question mark 
Javascript :: route guard in react js 
Javascript :: how to add two floats 
Javascript :: horizontal scrollview in react js 
Javascript :: check phone number validation in javascript 
Javascript :: how to separate string elements in javascript 
Javascript :: events onclick 
Javascript :: count length of a string javascript 
Javascript :: jquery select element with class 
Javascript :: check contect type axios response 
Javascript :: right mouse click js 
Javascript :: hide html elements 
Javascript :: setimout 
Javascript :: javascript Assigning to a non-writable property is not allowe 
Javascript :: The .querySelector() Method 
Javascript :: Add jquery in extension 
Javascript :: node_modules/metro/src/lib/attachWebsocketServer.js 
Javascript :: strupper in js 
Javascript :: how to send csrf middleware token in django ajax 
Javascript :: [JsonConverter(typeof(StringEnumConverter))] on list of enums 
Javascript :: angular 8 remove cookies 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =