title: Typeahead.js not populating the search box
body: <p>I was following this <a href="https://codeforgeek.com/2014/09/ajax-search-box-using-node-mysql/" rel="nofollow noreferrer">webpage</a> tutorial to populate a input box from the MYSQL database using Typeahead.js</p>
  
  <p><strong>Server.js</strong></p>
  
  <pre><code>const pool=mysql.createPool({
      connectionLimit:10,
      host:'localhost',
      user:'user',
      password:'password',
      database:'table'
  })
  router.get("/",(req,res)=&gt;{
      res.render("home")
  })
  
  
  
  
  router.get('/search',function(req,res){
      pool.query('SELECT tableName from parts where tableName like "%'+req.query.key+'%"',
      function(err, rows, fields) {
      if (err) throw err;
      var data=[];
      for(i=0;i&lt;rows.length;i++)
      {
      data.push(rows[i].tableName);
      }
      res.end(JSON.stringify(data));
      });
      });
  </code></pre>
  
  <p><strong>home.ejs</strong></p>
  
  <pre><code>&lt;script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"&gt;&lt;/script&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"&gt;&lt;/script&gt;
  &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"&gt;&lt;/script&gt;
  &lt;script src="typehead.js"&gt;&lt;/script&gt;
  
  &lt;script type="text/javascript"&gt;
      $(document).ready(function(){
  $('input.typeahead').typeahead({
  name: 'typeahead',
  remote: 'http://localhost:3000/search?key=%QUERY',
  limit: 10
  });
  
  });
  
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;input class="typeahead tt-query" spellcheck="false" autocomplete="off" name="typeahead" type="text" /&gt;
  </code></pre>
  
  <p>The typeahead.js library is loaded properly and I do not see any errors in my google chrome console. My database is also connected properly because, I have other routes which accesses the connection pool, which is working properly. The home route is loading the search bar but, when I type a table Name in there which exists in mySQL database, it does not give any auto complete.</p>