Live search box example code
Posted on 2012-09-07
I'm looking for a script for a livesearch box. This script should do the following:
* When typing, on each change (adding or deleting a character), a request to a file should be made.
* This file (query.php) executes a local query and gives back the results. These results may be xml, html or json. This works and is not part of the question!
* On each change, the query should be executed, so the results change.
* The results are shown in a list below the search box.
* You can select an item by clicking the mouse, after which that text is copied to the search box. This does not execute the search.
* Another option to select an item is by using the cursor keys and pressing enter, which copies that value to the search box.
* When moving back with the cursor, the original value that is typed in should be shown.
* Pasting and cutting text should result in another update, although this is not an absolute must have for now.