title: jquery autocomplete, loading from a text file
body: <p>I am trying to load in my jquery autocomplete data from a text file, to reduce page load size. I am trying:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(document).ready(function(){
              var practitioner_data = new Array();
              $.get("/live_practitioners.txt", { },
              function(data){
                  var data_array = new Array();
                  data_array = data;
                  $("#search_therapist_name").autocomplete(data_array, {minChars: 1, matchContains: true, mustMatch: true, selectFirst: false, formatItem: function(item) { return item.text; } }).result(function(event, item) { document[\'' . $str_form_name . '\'].counsellor_id.value=item.counsellor_id; });
              });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>Firebug shows me a first request to the txt file, and the data looks correctly formatted:</p>
  
  <pre><code>[{text:'Dr. Tania Abdulezer', counsellor_id:'877'}, {text:'Helen Acton', counsellor_id:'712'}]
  </code></pre>
  
  <p>However when I start typing into the text box, firebug is showing me a request being made, for each new letter typed, going to:</p>
  
  <pre><code>http://rscpplocal/%5B%7Btext:%27Dr.%20Tania%20Abdulezer%27,%20counsellor_id:%27877%27%7D,%20%7Btext:%27Helen%20Acton%27,%20counsellor_id:%27712%27%7D%5D?q=r&amp;limit=10&amp;timestamp=1296041901116
  </code></pre>
  
  <p>Firstly, I am not sure why it is making a new request each time, I thought the point of loading it in from a string, to then supply as data, was so only one request was needed. Secondly, I have no idea why those subsequent requests, seem to think the file name, is, the data! From what I can tell, that first argument to autocomplete can be either the data, or a URL. I guess autocomplete thinks that my data is in fact a URL.</p>
  
  <p>Any ideas what I am doing wrong please?</p>