title: Having problems with jQuery UI Autocomplete
body: <p>I'm trying to use the new <a href="http://jqueryui.com/demos/autocomplete/#option-source" rel="nofollow">autocomplete function</a> in jQuery UI, but I'm having some problems.</p>
  
  <p>I'm able to retrieve data from the DB (I can see it in FireBug), but I'm not able to display the dropdown list (or alert the data).</p>
  
  <p>This is my jQuery code:</p>
  
  <pre><code>  jQuery('#brand_search').autocomplete({
              source: "http://mysite.com/wp-content/themes/storelocator/include/jquery.search.php?instance=brand",
              minLength: 2,
              delay: 50,
              select: function(e, ui) {
                alert(ui);
              }
          });
  </code></pre>
  
  <p>And this is my PHP code:</p>
  
  <pre><code>/* ------------------ Brand Autosuggest ------------------------- */
    function autosuggestBrand($dal)
    { 
      $result = $dal-&gt;getRowBySearch('sl_label','name', $this-&gt;term);   
      $brands = array();
  
      if(mysql_num_rows($result)&gt;0) 
      {
        while($row = mysql_fetch_assoc($result)) 
        {
            array_push($brands, array(
              "id"      =&gt; $row['id'], 
              "name"    =&gt; html_entity_decode($row['name'], ENT_QUOTES, 'UTF-8') )
          );
        }     
      }
      echo json_encode($brands);          
    }
  </code></pre>
  
  <p>I've see these two guides:<br>
  <a href="http://www.jensbits.com/2010/03/29/jquery-ui-autocomplete-widget-with-php-and-mysql" rel="nofollow">http://www.jensbits.com/2010/03/29/jquery-ui-autocomplete-widget-with-php-and-mysql</a><br>
  <a href="http://net.tutsplus.com/tutorials/javascript-ajax/how-to-use-the-jquery-ui-autocomplete-widget" rel="nofollow">http://net.tutsplus.com/tutorials/javascript-ajax/how-to-use-the-jquery-ui-autocomplete-widget</a>  </p>
  
  <p>But still can't quite figure out how to display / alert the fetched data.</p>
  
  <p>This is the result from <code>echo json_encode</code></p>
  
  <pre><code>[
    {"id":"4642","name":"Mo Koshji"},
    {"id":"4627","name":"MO-A"},
    {"id":"4626","name":"MO'CYCLE"},
    {"id":"4628","name":"mo851"},
    {"id":"4629","name":"Mob Action"}
  ]
  </code></pre>