title: JSON for Jquery autocomplete
body: <p>I've JSON response from php file.</p>
  
  <pre><code>[{
    "NAME": "Kiev"
  }, {
    "NAME": "Kiev metro"
  }, {
    "NAME": "Kiev-Dnepro"
  }, {
    "NAME": "Kiev-Dnepro"
  }, {
    "NAME": "Kiev-Donetsk"
  }, {
    "NAME": "Kiev-Donetsk"
  }]
  </code></pre>
  
  <p>How can I use that for standard Jquery autocomplete? Autocomplete function do request but it seems it cant parse response for this json (simple array works fine).
   Help me please</p>
  
  <hr>
  
  <p>Derin, yes that's it. Works fine! But now I want to modify it a little. I getting more data in response and I'd like to display it near of main autocomplete input</p>
  
  <pre><code>var infoGISName = null;
  var infoGISType = null;
  var infoGISLocationID = null;
  var infoGISParentID = null;
  
  $('#GISName').autocomplete({
  source: function(request, response) {
    $.getJSON("autocomplete.php", {
      term: request.term
    }, function(result) {
      response($.map(result, function(item) {
        infoGISName = item.NAME;
        infoGISType = item.GIS_TYPE;
        infoGISLocationID = item.LOCATION_ID;
        infoGISParentID = item.PARENT_ID;
        return item.NAME;
      }));
    });
  },
  change: function(event, ui) {
    $('#infoGISName').html(infoGISName);
    $('#infoGISType').html(infoGISType);
    $('#infoGISLocationID').html(infoGISLocationID);
    $('#infoGISParentID').html(infoGISParentID);
  },
  minLength: 3
  
  });
  });
  </code></pre>
  
  <p>So how to change data in fields when I changed text in autocomplete input? Now I see just last values from JSON recordset</p>