No Scriptaculous Effects | Click here for the API document
Download now! | Example results script


In this example, I use the same dictionary I used in the WordLadder coding challenge. Simply start typing a word and the suggest tool will give you results.

(3 letters minimum required to trigger a suggestion)

Source Code:

<script type="text/javascript" src="../lib/prototype/prototype.js"></script> <script type="text/javascript" src="../lib/scriptaculous/scriptaculous.js"></script> <script type="text/javascript" src="../src/autocomplete.js"></script> <input type="text" id="my_ac" name="my_ac" size="45" autocomplete="off"/> <script type="text/javascript"> new AutoComplete('my_ac', 'assets/ac.php?m=xml&s=', { delay: 0.25 // Using the default XML result format }); </script>

Example using a Json-encoded result (either the X-JSON header or in the response body)

(3 letters minimum required to trigger a suggestion)

Source Code:

<script type="text/javascript" src="../lib/prototype/prototype.js"></script> <script type="text/javascript" src="../lib/scriptaculous/scriptaculous.js"></script> <script type="text/javascript" src="../src/autocomplete.js"></script> <input type="text" id="my_ac" name="my_ac" size="45" autocomplete="off"/> <script type="text/javascript"> new AutoComplete('my_ac2', 'assets/ac.php?m=json&s=', { delay: 0.25, resultFormat: AutoComplete.Options.RESULT_FORMAT_JSON }); </script>

Example using plain text results

(3 letters minimum required to trigger a suggestion)

Source Code:

<script type="text/javascript" src="../lib/prototype/prototype.js"></script> <script type="text/javascript" src="../lib/scriptaculous/scriptaculous.js"></script> <script type="text/javascript" src="../src/autocomplete.js"></script> <input type="text" id="my_ac3" name="my_ac" size="45" autocomplete="off"/> <script type="text/javascript"> new AutoComplete('my_ac3', 'assets/ac.php?m=text&s=', { delay: 0.25, resultFormat: AutoComplete.Options.RESULT_FORMAT_TEXT }); </script>