Created
October 30, 2017 19:25
-
-
Save MSerj/11ae190aeec1b631298ccd84aa1cc869 to your computer and use it in GitHub Desktop.
Reading GET variables with JavaScript
This file contains 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 characters
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