Created
October 30, 2020 19:35
Revisions
-
adamdehaven created this gist
Oct 30, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ /** * Return the value of a URL parameter * @param url String * @param key String */ const getUrlParam = (url, key) => { const results = new RegExp('[?&]' + key + '=([^&#]*)').exec(url) return results ? decodeURI(results[1]) : null }; // Get the URL const url = window.location.href // Usage if (getUrlParam(url, 'success')) { // Do something }