title: Integrating image with jQuery AutoComplete
body: <p>so I'm working on this project where I'm using jQuery autocomplete to  display search results from a mysql database. The search results are product names fetched from a database which has product images as well.
  How would I be able to display the product images like in the image below ?</p>
  
  <p><img src="https://i.stack.imgur.com/Dhlck.png" alt="enter image description here"></p>
  
  <p>Here's my jQuery auto complete page :</p>
  
  <pre><code>&lt;script&gt;
  $( "#birds" ).autocomplete({
        source: "search.php",
        minLength: 2,
        select: function( event, ui ) {
  
  
          log( ui.item ? "Selected: " + ui.item.value + " aka " + ui.item.label :
            "Nothing selected, input was " + this.actor );
           window.location.href = './products/' + ui.item.productid;
           //window.location.href = 'product_display.php?id=' + ui.item.value;
         // document.testForm.action = "pretravel.php?id="+ui.item.value;
          //document.testForm.submit();
        }
      });
    });
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>search.php</strong></p>
  
  <pre><code>&lt;?php
  include 'dbconnector.php';
  
  // Sanitise GET var
  if(isset($_GET['term']))
  {
  $term = mysql_real_escape_string($_GET['term']);
  // Add WHERE clause
  //$term="Apple";
  $query = "SELECT `productid`, `productname` FROM `products` WHERE `productname` LIKE '%".$term."%' ORDER BY `productid`";
  
  
  $result = mysql_query($query,$db) or die (mysql_error($db));
  $id=0;
  $return=array();
  while($row = mysql_fetch_array($result)){
  
      //array_push($return,array('label'=&gt;$row['productid'],'actor'=&gt;$row['productname']));
      //array_push($return,array('value'=&gt;$row['productid'],'label'=&gt;$row['productname']));
      //array_push($return,array('actor'=&gt;$row['productname'],'label'=&gt;$row['productid']));
      array_push($return,array('productid'=&gt;$row['productid'],'label'=&gt;$row['productname']));
  
  }
  
  header('Content-type: application/json');
  echo json_encode($return);
  //var_dump($return);
  
  exit(); // AJAX call, we don't want anything carrying on here
  }
  else
  {
      header('Location:index');
  }
  
  ?&gt;
  </code></pre>