title: Can't attach a form value to Jquery autocomplete source
body: <p>I spent a lot of time, to add additional parameters to the Jquery-Autocomplete-Source. But I can't get it finished. </p>
  
  <p>What I'm trying to do: I have an autocomplete form with a jQuery datasource. If you select something from the autocomplete, it will be inserted into a table (text and a hidden field with the id) and the function <code>lesen</code> is started (works fine). Function <code>lesen</code> reads the value of every element with the "class" <code>nutzerid</code> (the hidden field) to an array and puts it to an input field - the input field is the collector for all ids(works!). BUT! The autocomplete should read the value of this field an send it as a parameter to my JSON source. But it doesn't. The Firebug console shows an empty parameter. Even though an alert is able to show the value. I really don't know, what I'm doing wrong.</p>
  
  <p>I also tried to replace the input field (collector of all ids) by a variable. But the same problem occurs here. I can alert the value of the var. But trying to attach it to the source produces an empty param. I also tried to give the value to autocomplete via param, extraparams option. No success. I think there is a problem with joining the array. Maybe the step in <code>lesen</code> where all ids are pushed to an array and the array is filled into the form. But I'm out of ideas how to solve this.</p>
  
  <p>Why i'm doing this? I want the JSON source PHP to exclude the already selected ids in its MySQL query. What has been selected one the previous requests should not be displayed with autocomplete anymore. So I have to post, what was added to the requesting page before. And this is the way (probably not the cleanest) I've chosen. Imagine a shopping cart. If a product is attached to the shopping cart, it should not be displayed in future requests. Of course I'm open to new approaches. </p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;input type="text" id="ausschluss" /&gt;    
  </code></pre>
  
  <pre class="lang-js prettyprint-override"><code>$(document).ready(
  function() {
  
  
  
  //this functions reads every hidden field (form the added items) an puts the array as string to a hidden field      
  function lesen(){
              var itemsarray = [];
            $(".nutzerid").each(function () {
             var items = $(this).attr('value');
             itemsarray.push(items);
            });
            $( "#ausschluss" ).val(itemsarray);
  
            };
  
  
      //this function attaches the selection (from the autocomplete) to a table it creates text, a hidden field with the user id and a button
          function log( name, id ) {
              $("&lt;tr&gt; &lt;td&gt;"  + name + "&lt;input class='Entf' type='button' value ='Entfernen' /&gt;" + "&lt;input type='hidden' class='nutzerid' name='hiddenField' value='" + id + "' /&gt;&lt;/td&gt;&lt;/tr&gt;").appendTo("#log");
              $( "#log" ).attr( "scrollTop", 0 );
              lesen();
  
                     }
  //this is the autocompletepart
          $( "#REMOTE" ).autocomplete({
              source: "json.php?aus=" + $( "#ausschluss" ).val(), //this is not working. the firebug console shows an empty param (.php?aus=&amp;term=blabla
              minLength: 2,
              select: function( event, ui ) {
                  log(ui.item.value,ui.item.id);          
                  alert($( "#ausschluss" ).val());  //this works! after selecting an item from the autocomplete it shows me the value of the field "ausschluss", like it should be appended to the source
                  }
  
          });
  
  //this one captures the click of a button. identified by the class and kills the &lt;tr&gt; &lt;td&gt; and all elemtns in it        
  $('.Entf').live('click',function(event){
       $(this).parent().parent().remove();
       lesen();
     });
  
  
  
  
  });
  </code></pre>