title: jQuery UI Autocomplete Display "No search results"
body: <p>I want to display suggestions from mysql database using jQuery UI Autocomplete</p>
  
  <p>I have following form</p>
  
  <pre><code> &lt;form action="search.php" method="POST"&gt;
          &lt;input type="text" name="search" id="search-input"&gt;
          &lt;input type="submit" value="Submit" id="submit"&gt;
   &lt;/form&gt;
  </code></pre>
  
  <p>search.php</p>
  
  <pre><code>    &lt;?php 
  require_once 'db.php';
  
  $a = array();
  
      if (isset($_POST['search']) &amp;&amp; !empty($_POST['search'])) {
          $search_param = trim($_POST['search']);
  
          $slct_search = $db-&gt;prepare("SELECT student_name FROM student_details WHERE student_name LIKE ?") or die($db-&gt;error);
          $slct_search-&gt;bind_param('s', $search_param);
          $slct_search-&gt;execute();        
          $res = $slct_search-&gt;get_result();  
          if($res-&gt;num_rows) {            
              while ($result = $res-&gt;fetch_object()) {
                  $a[] = $result-&gt;student_name;
              }
              echo json_encode($a);
          } else {
              echo 'OOPS we had a problem';
          }   
      }
  ?&gt;
  </code></pre>
  
  <p>The search.php working fine. it returns</p>
  
  <blockquote>
    <p>["ravi","ravi"]</p>
  </blockquote>
  
  <p>JS Code</p>
  
  <pre><code>    $(function() {
        $("#search-input").autocomplete({
          source: "search.php",
          minLength: 2
        }); 
      });
  </code></pre>
  
  <p>The Problem is when I start type in text box immediately displayed </p>
  
  <blockquote>
    <p>No search results.</p>
  </blockquote>
  
  <p>i also tried <a href="https://stackoverflow.com/questions/26879725/jquery-ui-autocomplete-search-results-do-not-display">JQuery UI Autocomplete Search Results do not display</a></p>