Due: 5 Mar 2012, 11:59pm
AbstractCreate an "auto-suggestion" feature using AJAX to communicate with server-side logic in order to look up possible suggestions in your database, similar to Google's auto-suggest.
AssignmentIn this assignment, you'll be developing auto-suggestion functionality for a general text box. As characters are typed into the text box, the text that has been typed so far should be submitted to the server, which will then look up any search terms that begin with what has been typed. These terms should be sent back to the client so that they can see them displayed below the text box---all without reloading the page. Finally, if the user clicks on a term that appears in the auto-suggest list, their search box should be completed with that term.
To search MySQL for text that starts with something, use the LIKE keyword with the % wildcard (WHERE column LIKE "text%"). You can concatenate your query with the % symbol using LIKE CONCAT (:search, '%') or by concatenating them in PHP before passing them into the query.
To encode a PHP array with JSON to send to the client, use json_encode.
To evaluate a JSON response (in JavaScript), use:
eval('(' + response + ')');
To run a JavaScript function whenever input in a text box has changed, use the oninput event handler.
NotesYou are required to use PHP's PDO functionality for MySQL, not the older (and deprecated) mysql_ functions.
As before, external libraries are still not allowed.
Homework SubmissionAs detailed on the homework submission page, this homework must be on the class web server in a folder titled homework11 for it to be graded.