getting get var out of a url string js code example
Example 1: js get url variables
const postID = (new URLSearchParams(window.location.search)).get('post');
Example 2: set get variable in url
examplepage.php?var1=value&var2=value
const postID = (new URLSearchParams(window.location.search)).get('post');
examplepage.php?var1=value&var2=value