title: Passing HTML INPUT field ID to PHP completion program in jQuery Autocomplete
body: <p>I want to pass the id of the INPUT field to the PHP file providing options. Here's my HTML &amp; jQuery code. But the PHP program gets the id as <code>undefined</code>. Thanks for helping.</p>
  
  <p>jQuery :</p>
  
  <pre><code>    $('.classfield').autocomplete({
  
        //define callback to format results
        source: function(req, add){
  
          //pass request to server
          $.getJSON("ajax/ajax_suggestions.php?id="+$(this).attr('id')+"&amp;callback=?", req, function(data) {
  
            //create array for response objects
            var suggestions = [];
  
            //process response
            $.each(data, function(i, val){
              suggestions.push(val.name);
            });
  
            //pass array to callback
            add(suggestions);
          });
        },
  
        //define select handler
        change: function(e) {
          $("#spill").html("change "+$(this).val()+e.type);
        }
      }); // autocomplete
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;input type="text" class="classfield" id="hello" value="there"&gt;&lt;/input&gt;&lt;br&gt;
  </code></pre>