Skip to content

Instantly share code, notes, and snippets.

@rruhlen
Created June 26, 2017 23:10
Show Gist options
  • Save rruhlen/2be48ab7e555da3f60501feff5726fd5 to your computer and use it in GitHub Desktop.
Save rruhlen/2be48ab7e555da3f60501feff5726fd5 to your computer and use it in GitHub Desktop.
Grab company GET parameter.
<script type="text/javascript">
$(function() {
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
};
var companyid = getUrlParameter('companyid');
$(function() {
$('<custom field>').val(companyid);
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment