Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

How can I get query string values in JavaScript?

function getQuerystring(key) {
    var query = window.location.search.substring(1);
    var vars = query.split("&");
    for (var i = 0; i < vars.length; i++) {
        var pair = vars[i].split("=");
        if (pair[0] == key) {
            return pair[1];
        }
    }
}
Comment

work with query string javascript

URLSearchParams
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to print two arrays side by side in javascript 
Javascript :: gatsby-plugin-create-client-paths 
Javascript :: on load of jquery 
Javascript :: faker.js lorem 
Javascript :: place footer at the bottom of the page react 
Javascript :: remove whitespace javascript 
Javascript :: angular httpclient query params not working 
Javascript :: jquery trigger click other element 
Javascript :: how to loop through an object using lodash 
Javascript :: hide element when pressing button angular 
Javascript :: javascript get all keys of object 
Javascript :: jquery Audio Play on button click 
Javascript :: jquery delete a cookie 
Javascript :: async fetch api call 
Javascript :: datatable without pagination 
Javascript :: javascript json string 
Javascript :: combine two arrays javascript 
Javascript :: template literal syntax not working 
Javascript :: why use currying 
Javascript :: javascript check if var is string 
Javascript :: RFC 3339 format js 
Javascript :: jquery trigger link click 
Javascript :: js format urcurency 
Javascript :: js window redirect 
Javascript :: jq get by name 
Javascript :: jquery datepicker set default date 
Javascript :: javascript regex escape forward slash 
Javascript :: loopback find with limit 
Javascript :: javascript create array of objects with map 
Javascript :: react overflow scroll 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =