get a url var in js code example Example: js get url variables const postID = (new URLSearchParams(window.location.search)).get('post');