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 :: how to convert string into binary in javascript 
Javascript :: config mode en webpack 
Javascript :: unique array in javascript 
Javascript :: json db 
Javascript :: babel start command nodejs 
Javascript :: react functional components 
Javascript :: usecontext hook react 
Javascript :: javascipt delay 
Javascript :: adjust color of text js javascript 
Javascript :: jest wait for timeout 
Javascript :: 1. Write regular expression to describe a languages consist of strings made of even numbers a and b. CO1 K3 
Javascript :: js create json from object 
Javascript :: javascript get page args 
Javascript :: jquery do something if toggle open and close 
Javascript :: convert form data request to json laravel 
Javascript :: scroll value bottom js 
Javascript :: Select radio button through JQuery 
Javascript :: execute command js 
Javascript :: yup phone number validation 
Javascript :: disable input box javascript 
Javascript :: adding a timer in a quiz game 
Javascript :: prevent redirect javascript 
Javascript :: link to website electron 
Javascript :: react router lazy load 
Javascript :: flutter webview enable javascript 
Javascript :: checking scroll position with js 
Javascript :: rerender a vue component 
Javascript :: for each array javascript 
Javascript :: javascript filter 
Javascript :: javascript loop over three-dimensional array 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =