Skip to content

Instantly share code, notes, and snippets.

@MSerj
Created October 30, 2017 19:25
Show Gist options
  • Save MSerj/11ae190aeec1b631298ccd84aa1cc869 to your computer and use it in GitHub Desktop.
Save MSerj/11ae190aeec1b631298ccd84aa1cc869 to your computer and use it in GitHub Desktop.
Reading GET variables with JavaScript
function getUrlVars() {
var vars = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
vars[key] = value;
});
return vars;
}
$(document).ready(function() {
//read get variable
var activate = getUrlVars()['activate'];
if (activate == 'true') {
$('#modal_activate').arcticmodal();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment