Answers for "check url param javascript"

2

js check for url parameter

const params = new URLSearchParams(window.location.search);

// Check if we have the param
if (params.has("myParam")) {
  console.log("Yep!  We have it.  Value is: " + params.get("myParam"));
} else {
  console.log("The param myParam is not present.");
}
Posted by: Guest on May-08-2021
9

js get url parameter

const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const code = urlParams.get('code')
Posted by: Guest on October-18-2020
0

get url params with js

const queryString = window.location.search;

const urlParams = new URLSearchParams(queryString);

const page_type = urlParams.get('page_type')

console.log(page_type);
Posted by: Guest on August-08-2021
1

get parameters from url

www.test.com/t.html?a=1&b=3&c=m2-m3-m4-m5
Posted by: Guest on July-09-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language