<!-- START code for sending selected dropdown value to the TY page as URL parameter -->
<script>
$(document).ready(function() {
//define function that appends the parameter to the redirect URL
var sendAsParameter = function(selectedOptionParam) {
var redirectUrl = $('form.email-form').find('input[name="redirect"]').val();
//clean the url of any old parameters
var cleanRedirectUrl = redirectUrl.match(/.+\.hollard\.co\.za\//g);
$('form.email-form').find('input[name="redirect"]').val(cleanRedirectUrl[0] + "?product=" + selectedOptionParam);
};
//define on change event for dropdown
$('select[name="' + window.btoa('CHOOSE PRODUCT*') + '"]').change(function(e) {
//get the option
selectedOptionArg = this.options[e.target.selectedIndex].text;
//cosmetize value
selectedOptionArg = selectedOptionArg.replace(' ', '-');
//append the value and the parameter to the redirect URL
sendAsParameter(selectedOptionArg);
});
});
</script>
<!-- END code for sending selected dropdown value to the TY page as URL parameter -->