title: Escaping a forward slash / for variable in Ajax URL
body: <p>I'm working with existing code which validates a user's submission by sending to a given URL via Ajax:</p>
  
  <pre><code>var url = '/foo/bar/' + valuea + '/' + valueb + '/' + valuec; 
  </code></pre>
  
  <p>Which is then sent via ajax:</p>
  
  <pre><code> $.ajax({
      type : 'GET',
      url  : url,
      // data : data,
      success :  function(response)
      {...
      }
   });
  </code></pre>
  
  <p>The issue lies when the user input contains a forward slash e.g.:</p>
  
  <p><code>valuec = ABC/DEF</code></p>
  
  <p>As then the url becomes defined as:</p>
  
  <p><code>/far/bar/{valuea}/{valueb}/ABC/DEF</code></p>
  
  <p>Which results in a whole different URL structure and 404s.</p>
  
  <p>Is there a way I can escape this value to maintain the required URL structure?</p>
  
  <p>I've tried the likes of <code>replace(/\//, '\/');</code> and also <code>encodeURIComponent()</code> but neither help.</p>
  
  <p>My current thinking is a workaround to rewrite any '/' in the user submitted data to something else (e.g. |) so I can parse it to the URL, and then re-adjust it upon return, but that's a bit of a messy workaround imho.</p>
  
  <p>Thanks in advance</p>