0

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

3
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by anand01
0

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.

Example:
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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.