title: jQuery autocomplete with MySql data using Classic ASP
body: <p>I would like to add the jQuery autocomlete feature based on data fetched from MySQL, using Classic ASP and a combination of server-side scripting (VBScript and JavaScript for jQuery).
  The problem is $ is not recognised since the jQuery scripting tags are loaded (logically) only after the server-side work is completed.
  Is there a way to run the jQuery scripting tags on the server-side? After all jQuery is merely a library?
  If not, what would be your solution for an autocomplete feature based on MySQL-stored data?
  Thanks!</p>
  
  <p>My code is:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
    &lt;link rel="stylesheet" href="../source_scripts/jquery-ui.css"&gt;
    &lt;script src="../source_scripts/jquery-3.1.1.min.js"&gt;&lt;/script&gt;
    &lt;script src="../source_scripts/jquery-ui-1.12.1/jquery-ui.min.js"&gt;&lt;/script&gt;
  
    &lt;%
      Set c = Server.createObject("adodb.connection"): c.Open "Driver=MySQL ODBC 3.51 Driver;Server=188.121.44.188;UID=admin;PWD=Password;Database=testingDB;Option=3"
      Set r = Server.createObject("adodb.recordset"): r.activeConnection = c
      r.Open "SELECT * FROM testTable"
      do until r.eof
        call addTags(r("Name"),r("Surname"),r("ID"))
        r.movenext
      loop
      call autoSearch()
    %&gt;
  
    &lt;script language="javascript" runat="server"&gt;
      searchTags = new Array;
      function addTags(a,b,c){
        searchTags.push(a + " " +b + "  (" + c + ")");
      }
      function autoSearch(){
        $(function(){
          $("#searchline").autocomplete({
            source: searchTags
          });
        });
      }
    &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
    &lt;input id="searchline" type="text"&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>