Skip to content

Instantly share code, notes, and snippets.

@agupta93
Last active March 27, 2020 08:19
Show Gist options
  • Select an option

  • Save agupta93/6010708f4b6d3d76103351d7c78b094b to your computer and use it in GitHub Desktop.

Select an option

Save agupta93/6010708f4b6d3d76103351d7c78b094b to your computer and use it in GitHub Desktop.
<script type="text/javascript"><!--{literal}>
function getVisitor() {
console.log('getVisitorCalled');
var visitorInput = document.getElementById('ID_form79fea66b_guest_register_receipt_visitor');
var visitor = visitorInput && visitorInput.value;
return visitor;
}
function redirectToVisitorPage() {
console.log('redirect called.');
var VISITOR_TO_REDIRECT_URL = {
1: "https://google.com",
}
var selectedVisitor = getVisitor();
var redirectUrl = VISITOR_TO_REDIRECT_URL[selectedVisitor];
if (redirectUrl) {
window.location.href = redirectUrl;
}
}
redirectToVisitorPage()
// -->
{/literal}</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment