title: jQuery autocomplete pre-filtered results - show all
body: <p>I have an ajax function which searches a database of users. All usernames get put into an array like</p>
  
  <pre><code>var usernames = ["Mike Scott", "Mike Whosname", "Mike Johns", "Mike Nicolas"];
  </code></pre>
  
  <p>So simply, I want the autocomplete to just display whatever is in this array. Either that or turn the search off completely so it doesn't filter my results for a second time.</p>
  
  <p>The reason for this is, my SQL code also searches userid's so if I type for example "mscott", my servlet returns "Mike Scott" which gets put into the <code>usernames</code> array.</p>
  
  <p>I want them to be able to select "Mike Scott" if they input "mscott". </p>
  
  <p>The autocomplete is trying to search my array for "mscott" which is not displaying any results so I want it to just simply display everything in my array.</p>
  
  <p>Is this possible?</p>
  
  <p>Thanks.</p>
  
  <p>Current code:</p>
  
  <pre><code>$('#userInput').autocomplete({source: usernames, search: "", minLength: 0}).keyup(function(){
  
  var url = "/AJAX/SearchUsers.do?searchQ=mscott";
          $.ajax(url, {
            type: "GET",
            datatype: "json",
            success: function(data) {
              for (var i =0; i &lt; data.length; i++) {
                usernames.push(data[i].username);
            }
          }
        });
      $(this).autocomplete("option", {source: usernames, search: "", minLength: 0});
  
    });
  </code></pre>