Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js add params to url

function setQueryStringParameter(name, value) {
    const params = new URLSearchParams(window.location.search);
    params.set(name, value);
    window.history.replaceState({}, "", decodeURIComponent(`${window.location.pathname}?${params}`));
}
Comment

how to add parameters to url javascript

// Easy Way - how to add parameters to url javascript

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

MyURL.set('Name', 'HazaaZOOZ');

window.location.search = MyURL;
Comment

set url parameters javascript

let params = new URLSearchParams(window.location.search);
console.log(params.get(name));
Comment

how to pass parameter in url in javascript

you can use backticks ``
// url params
const elemA = "Los Angelis";
const elemB = "London";
window.location.href = `http://www.gorissen.info/Pierre/maps/googleMapLocation.php?lat=${elemA}&lon=${elemB}&setLatLon=Set`;
Comment

PREVIOUS NEXT
Code Example
Javascript :: convert number to string date js 
Javascript :: vue test form input 
Javascript :: implement the remove property function 
Javascript :: javascript get second last element in array 
Javascript :: calling javascript functions from unity scripts 
Javascript :: samesite cookie nodejs 
Javascript :: how to get contrast from a color using js 
Javascript :: asignar val select2 js 
Javascript :: javascipt get last element of array 
Javascript :: Detecting a mobile browser 
Javascript :: mongodb filter array 
Javascript :: eslint allow console 
Javascript :: javascript reverse array 
Javascript :: onload multiple functions 
Javascript :: jquery fade opacity 
Javascript :: javascript select all elements 
Javascript :: How to make "select option" select option for quantity 
Javascript :: JS get min date 
Javascript :: apa itu this pada javascript 
Javascript :: javascript const require 
Javascript :: check if body has class javascript 
Javascript :: sleep js 
Javascript :: express ejs layout use different layout 
Javascript :: foreach loop in jquery 
Javascript :: jest array contain object with prop 
Javascript :: string to int js 
Javascript :: angular access current scope from console 
Javascript :: typescript css variables 
Javascript :: make ajax calls with jQuery 
Javascript :: html2pdf cdn 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =