title: Sharepoint 2013 Rest API - oData $filter query is still remembering white space I eliminated in javascript
body: <p>I'm trying to create a custom input field with autocomplete features in my Sharepoint page.  I'm using the Rest API to $filter the input value using "substringof."  So far it's working but now I'm trying to consider if people typed in spaces.<br>
  For example, if someone typed " Joe" instead of "Joe" then it will no longer find results. Hence, I tried to eliminate the blank spaces with Javascript but the query is still not providing results when there are blank spaces.  Anyone have a clue why? Here is my function below:</p>
  
  <pre><code>function q_Names(term){
  var termSplit = term.split(";");
  var t = termSplit[termSplit.length-1].charAt(0).toUpperCase() + termSplit[termSplit.length-1].slice(1);
  //var q = t.split(" ").join("");
  var q = t.replace(/\s+/g, '');
  if(q.length&gt;1){
      alert(path + "web/siteusers?$select=Id,Title&amp;$filter=substringof('"+q+"',Title)");
      $.ajax({
          url: path + "web/siteusers?$select=Id,Title&amp;$filter=substringof('"+q+"',Title)",
          type: "GET",
          headers: { "Accept":  "application/json;odata=verbose" },
          success: function(data){ 
              //alert( JSON.stringify(data) );
              var str = ""
              for(var i=0; i&lt;data.d.results.length; i++){
                  str=str + "&lt;div&gt;&lt;a href='javascript:acf_author();'&gt;";
                  str=str + data.d.results[i].Title + "&lt;/a&gt;&lt;/div&gt;";
              }
              $("#ac_Author").html(str);
          },
          error: function(data){ alert('could not find user!'); }
      });
  }
  }
  </code></pre>