title: How to populate extra fields with jQuery autocomplete
body: <p>I am passing complex JSON data to  <strong>jQuery autocomplete plugin</strong>. And it is working <strong><em>fine</em></strong> so it shows the list of <code>Products</code>.</p>
  
  <p><img src="https://i.stack.imgur.com/DF1Mk.png" alt="enter image description here"></p>
  
  <p>Now I want to get somehow <code>Price</code> that is already included into JSON data and when I select product from <strong>autocomlete list</strong> I would like to populate <code>input</code> tag with <code>Price</code>.</p>
  
  <p>I really cannot get if it is possible to do. What I know that data is already in JSON but how to get it?</p>
  
  <p>Any clue?</p>
  
  <p>Here is JS for jQuery autocomplete plugin</p>
  
  <pre><code> function CreateAutocomplete() {
  
          var inputsToProcess = $('[data-autocomplete]').each(function (index, element) {
              var requestUrl = $(element).attr('data-action');
  
              $(element).autocomplete({
                  minLength: 1,
                  source: function (request, response) {
                      $.ajax({
                          url: requestUrl,
                          dataType: "json",
                          data: { query: request.term },
                          success: function (data) {
                              response($.map(data, function (item) {
                                  return {
                                      label: item.Name,
                                      value: item.Name,
                                      realValue: item.UID                                   
                                  };
                              }));
                          },
                      });
                  },
                  select: function (event, ui) {
  
                      var hiddenFieldName = $(this).attr('data-value-name');
                      $('#' + hiddenFieldName).val(ui.item.UID);
                  }
              });
          });
      }
  </code></pre>
  
  <p>To make clear <code>item.LastPrice</code> has <code>Price</code> data.</p>
  
  <p>And <strong>HTML</strong></p>
  
  <pre><code>   @Html.AutocompleteFor(x =&gt; x.ProductUID, Url.Action("AutocompleteProducts", "Requisition"), true, "Start typing Product name...", Model.Product.Name)
  </code></pre>