I believe I have most of this right, but may be messing up the order, and can't get a fiddle to save for some reason. Basically I need to grab part of a form Input and append it as a query string on submit so as to trigger the affiliate cookie on the next page. All codes would start with a AAA-11 value and then the actual affiliate reference code. So
<form>
<label>Affiliate Code</label>
<input type="text" id="code">
<input type="submit" id="submit_btn">
</form>
And the JS:
$('#submit_btn').on('click', function() {
var str = $('#code').val();
var acode = str.substr(6);
location.href = location.href + "?ref=" + acode;
});
What am I missing here?