This should be trivial.
See the snippet below, using jQuery's autocomplete plugin (http://docs.jquery.com/Plugins/Autocomplete
). It gives me two input boxes, one in which I can search users by their last name, the other by their username. I type a few letters, get a few suggestions, press enter and the last name or username appears. Up to that part, the documentation was good enough.
Then the documentation begins to go in all directions and seems to forget to explain the obvious: once I've found the person, I probably want to see his profile page after selecting him/her. Since I've loaded PHP arrays, it's really just opening the profile page for user number X.
So my question is simple: suppose that I autocomplete to Jack Smith, and want to see his profile page by clicking the enter key, (i.e., opening, say, user_profiles.php?user_id=
332), what do I have to add to the snippet?
<p>Find by last name: <input type="text" id="last_names" /></p>
<p>Find by username: <input type="text" id="usernames" /></p>