title: Escaping slashes in jQuery for passing paths in an AJAX request
body: <p>I have a problem with slashes! I have some jQuery for handling generic dialogs on a page. In some cases the fields are passing /-delimited paths...</p>
  
  <pre><code>var fieldValues = [];
  // pull values from all the fields belonging to the dialog...
  $.each($(this).find('input, textarea, select'), function(n,field) {
    // escape the path fields
    var value = escape($(field).val().replace(/\//g,'__slash__'));
    //alert ($(field).attr('id')+'='+value);
    if(id != '' &amp;&amp; value != '') {
      fieldValues.push(id+'='+value);
    }
  });
  </code></pre>
  
  <p>This code works, but I have a manual stripping out of __slash__ when I get to the php end of things. Is there some encoding function I'm missing that would let me drop the clumsy-looking replace?</p>