Hi all,
I am completely new to Ajax, I need to create Telephone directory.
Telephone numbers and phone are in database, I designed UI like two text boxes for search by name search by number. I have one div which displays the search results. It is a J2ee application, I am getting the results when i enter the number or name completely then submit the button.

Now I need to re design like,the result should appear when I Type partial information.It should like when I type letter A in name text box it should displays the list of names which starts with the letter A .How can I do that.
could any one help me
Thanks in advance

"Like two text boxes" or genuinely two text boxes?

Use the onkeypress event instead of using the submit button to grab your data. You may want to modify this though so that it only starts grabbing after "n" characters, then save the results in memory and iterate over those results rather than calling the web service again.

Do search for a phone number after the 3rd number is pressed.
Save the results from the 3rd key press into an array (or something else that you can search through)
On keypresses after the 3rd, search for results in the array rather than making another call to the database.

This will only be beneficial if you are not dealing with huge results. If you are, refine it to do it on the fourth or fifth key press.

This is my 2 two cents.

thanks Airshow and stbuchok