getUrlParameter js

const getUrlParameter = (name, locationSearch) => { name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'); var results = regex.exec(locationSearch); return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' ')); }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.