title: Passing extra parameters to source using Jquery UI autocomplete
body: <p>I'm trying to pass extra parameters for city and state using the jQuery UI autocomplete function.  I've been trying to find an answer to this for a while but can't seem to find something that works for me.  </p>
  
  <p>My current code is:
  </p>
  
  <pre><code>$(document).ready(function () {
      $("#id_place").autocomplete({
          source: function(request, response) {
              $.ajax({
                  url: "/autocomplete_place",
                  dataType: "json",
                  data: {
                      term: request.term,
                      city: $("id_city").val(), 
                      state: $("id_state").val(),
                      test: 4
                  },
                  success: function(data) {
                      response(data);
                  }
              });
          },
      });
  });
  </code></pre>
  
  <p>The autocomplete works, but its not passing my city and state parameters to the function.  If I type <code>v</code> it requests the URL: <code>/autocomplete_place?term=v&amp;test=4</code></p>
  
  <p>I'm guessing its evaluating the <code>val()</code> of city and state upon <code>(document).ready()</code> and getting blank values for these form fields?  I thought making source into an ajax function would solve that, but perhaps not.</p>
  
  <p>Any ideas?</p>