Skip to content

Instantly share code, notes, and snippets.

View csinghdev's full-sized avatar
👨‍💻

Chandresh csinghdev

👨‍💻
View GitHub Profile
https://jennamolby.com/how-to-use-cookies-to-capture-url-parameters/
// Parse the URL
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)");
var results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}