title: Use Jquery to append a field input value to the url as a query string
body: <p>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</p>
  
  <pre><code>&lt;form&gt;
      &lt;label&gt;Affiliate Code&lt;/label&gt;   
      &lt;input type="text" id="code"&gt;
      &lt;input type="submit" id="submit_btn"&gt;        
  &lt;/form&gt;
  </code></pre>
  
  <p>And the JS:</p>
  
  <pre><code>$('#submit_btn').on('click', function() {
      var str = $('#code').val();
      var acode = str.substr(6);
      location.href = location.href + "?ref=" + acode;
  });
  </code></pre>
  
  <p>What am I missing here?</p>