If the data that will be used for autocomplete is relative not big, then we can use the option to load it at once to the client and to to make requests to the server every time the user type in the autocomplete field.

Below is the example which demostartes this. We will use the index.php from the Simple Autocomplete

One option will be added loadAll.
Note how the SelectCommand is written. In this case we do not need to have a where clause.

The autocomplete.php file is:

<?php // include the Database driver class (we will use PDO). require_once 'jq-config.php'; require_once "php/jqGridPdo.php"; // include the jqUtils Class. The class is needed in all jqSuite components. require_once "php/jqUtils.php"; // include the jqAutocomplete Class require_once "php/jqAutocomplete.php"; // Connection to the server $conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD); // Tell the db that we use utf-8 $conn->query("SET NAMES utf8"); // create autocomplete instance $ac = new jqAutocomplete($conn); //write the select command $ac->SelectCommand = "SELECT CompanyName FROM customers ORDER BY CompanyName"; // set the source from where to get data. In this case it is the same file. $ac->setSource("autocomplete.php"); // Tell the component to load all the data at once $ac->loadAll = true; // Enjoy $ac->renderAutocomplete("#company"); ?>