title: jQuery UI Autocomplete - No results found
body: <p>I have the following</p>
  
  <pre><code>&lt;form action="" method="post"&gt;
    &lt;input type="text" class="auto" name="search" autocomplete="off"&gt;
  &lt;/form&gt;
  
  &lt;script&gt;
    $(document).ready(function($){
      $('.auto').autocomplete({
       source:'connect.php',
       minLength:1
      });
    });
  &lt;/script&gt;
  </code></pre>
  
  <p>And connect.php
  I KNOW I have to sanitize $term before inputting it into my query.</p>
  
  <pre><code>if(isset($_GET['term'])) {
    require "db.php";
  
    $con = mysqli_connect("$host","$user","$password","$db");
  
    if (mysqli_connect_errno())
      {
      echo "Failed to connect to MySQL: " . mysqli_connect_error();
      }
  
    $term = $_GET['term'];
    $query = "SELECT `name` FROM `products` WHERE `name` LIKE '%$term%'";
    $result = mysqli_query($con, $query);
  
    while ($row = mysqli_fetch_array($result)) {
      echo json_encode($row);
    }
  }
  </code></pre>
  
  <p>If I typed <code>M</code> in the input field and use chrome tools to inspect the response, I get this.</p>
  
  <blockquote>
    <p>{"0":"MacBook Pro 13-inch","name":"MacBook Pro 13-inch"}{"0":"MacBook
    Pro 15-inch","name":"MacBook Pro 15-inch"}{"0":"MacBook Air
    13-inch","name":"MacBook Air 13-inch"}{"0":"MacBook Air
    11-inch","name":"MacBook Air 11-inch"}{"0":"iMac
    21.5-inch","name":"iMac 21.5-inch"}{"0":"iMac 27-inch","name":"iMac 27-inch"}{"0":"Mac Pro Quad-Core","name":"Mac Pro Quad-Core"}{"0":"Mac
    Pro 6-Core","name":"Mac Pro 6-Core"}</p>
  </blockquote>
  
  <p>However, for some reason, it states 'No results found' on the page even though there is?</p>