title: How to attach additional properties for the jQuery Autocomplete select event
body: <p>My current code looks like this:</p>
  
  <pre><code>$(document).ready(function () {
      $('#txtSearchForTrainingFacility').autocomplete({
          select: function (event, ui) {
                      searchCallback(event, ui);
                  },      //  select
          source: function (request, response) {
              $.ajax({
                  url: 'http://localhost:49795/Ajax/Search/' + $('#txtSearchForTrainingFacility').val(),
                  dataType: 'json',
                  data: {},
                  success: function (data) {
                      response( $.map( data, function( item ) {
                          return {
                              label: item.Name,
                              value: item.Value,
                              id: item.ID
                          }   //  return object
                      }))     //  response
                  }           //  success
              })              //  ajax
          }                   //  source function
      });                     //  autocomplete
  });                         //  document.ready
  </code></pre>
  
  <p>You can see that in the <code>ajax.success</code> event function I am mapping returning an object with <code>label</code>, <code>value</code>, and <code>id</code> properties - yet the <code>autocomplete.select</code> method's <code>ui.item</code> parameter only contains <code>label</code> and <code>value</code>.</p>
  
  <p>What am I doing wrong?  How can I get the <code>id</code> property to appear on the <code>autocomplete.select</code>'s <code>ui.item</code> object?</p>
  
  <blockquote>
    <p>the result of the ajax call is a json array, with each element an object that contains the properties <code>Name</code>, <code>Value</code>, and <code>ID</code>.</p>
  </blockquote>
  
  <p><strong>Note</strong>
  If you replace the ajax call with a fixed array <code>[{id: 1, label: 'bob', value: 'creep'}, {id: 2, label: 'joe', value: 'friend'}]</code> then the <code>id</code> property seem to come through in the select event just fine.</p>