Answers for "how to get url variable in javascript"

7

get parameters from url

var url_string = "http://www.example.com/t.html?a=1&b=3&c=m2-m3-m4-m5"; //window.location.href
var url = new URL(url_string);
var c = url.searchParams.get("c");
console.log(c);
Posted by: Guest on July-09-2020
-1

js get url variables

const postID = (new URLSearchParams(window.location.search)).get('post');
Posted by: Guest on February-11-2021
0

set get variable in url

examplepage.php?var1=value&var2=value
Posted by: Guest on October-29-2020

Code answers related to "how to get url variable in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language