473,402 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Ajax - timer

I have the following code where when user types in the txtName textbox the program retrieves list of names from a database, the problem is this occurs after every key stroke. So if I want to look for Microsoft and I type 'Mic' the program will perform 3 searches with the first one being the longest because it would retrieve all of the names starting with 'M'. What I want to be able to do is if a user types 'Mic' without pausing the computer would wait until there's a pause in typing before performing a search.

What would I have to do to make this happen, how can I create some king of timer in JScript - my JScript knowledge is limited?

Thank You

Peter

Here's my code

//////////////// C# - ASP.NET 1.1 //////////////////////////////

this.txtName.Attributes.Add("onkeyup", "return GetList();");

//////////////// JScript //////////////////////////////

function GetList()
{
try
{
obj = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
obj = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e1)
{
obj = null;
}
}
if(obj!=null)
{
document.body.style.cursor = 'wait';

obj.onreadystatechange = ProcessResponse;
obj.open("GET", "http://mywebsite.com=" + document.getElementById("txtName").value, true);
obj.send(null);

document.body.style.cursor = 'default';
}
return false;
}
Feb 7 '06 #1
1 1138


Hi Peter,

Thanks for the posting at the newsgroup!

"pausing the computer would wait until there's a pause in typing before
performing a search."
I understand this is really one performance issue for the customer at
typing. Each query (search) to the server when customer type one letter is
a performance hit to this issue. So currently I have two suggestions for
you that:

1. At the first typing, please query the database to perform the query
retrieving the phrase/word with the first letter as the customer typed.
Store the search result at the client web page. Then for other letters
inputted by the customer, we only need to search the local search result to
provide the phrase/word for the customer's reference.

This will only need one query to the server side and there is no need for
us to perform the follow-up queries because all the phrases/words are
stored at the client side after the customer typed the first letter.

2. if your phrase/word database is not very huge, you could directly send
all the data to the client web page. Then we only need to query the data at
the client side. There is no any query required after the page load. This
will give the customer one Web UI performance as the same as in desktop
windows.
Please note, if your database is very huge, this is not very approciate for
you.

Please feel free to let me know if you have any further question on this
issue. Have a nice day!

Best Regards,
Wei-Dong Xu
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ===
Business-Critical Phone Support (BCPS) provides you with technical phone
support at no charge during critical LAN outages or "business down"
situations. This benefit is available 24 hours a day, 7 days a week to all
Microsoft technology partners in the United States and Canada.
This and other support options are available here:
BCPS:
<https://partner.microsoft.com/US/technicalsupport/supportoverview/40010469>

Others: <https://partner.microsoft.com/US/technicalsupport/supportoverview/>
If you are outside the United States, please visit our International
Support page:
<http://support.microsoft.com/default.aspx?scid=%2finternational.aspx>.
================================================== ===
This posting is provided "AS IS" with no warranties, and confers no rights.

Feb 7 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: SimonPlatten | last post by:
Hi, I'm a software engineer working in the offshore industry, I've been coding in various languages professionally since 1987. In my present employment I am working with control systems in the...
1
by: Bob | last post by:
Hi, Hope you can help me with this one. I'm at my wits end. I'm trying to create an intelligent edit-box like the excellent "Customer" one at the URL: ...
5
by: Steve Wright | last post by:
I have an AJAX routine on a webpage that is working in IE6, but not IE7 or Firefox v2.0.0.2 The webpage is http://www.a-drop-in-the-ocean.co.uk/CWS/monitor10bins.php?quarry=401 The AJAX...
6
by: =?Utf-8?B?U2hhd24gU2VzbmE=?= | last post by:
Greetings! I was researching AJAX to provide a solution to displaying status messages while a long process executed. I found several examples online and was able to use their code to get a quick...
5
by: fjm | last post by:
Hi everyone, I usually hang out on the php side because its what I know, but I am faced with a problem that I honestly have no idea how to solve and figured I would try my luck over here. I am hoping...
1
by: shawnwperkins | last post by:
Hi Guys, I'm new to Javascript and have a couple of questions that I hope someone could quickly answer for me. First, I'm trying to modify an example Ajax script to fit my needs. The script...
6
by: Scott M. | last post by:
What is the version number of AJAX when we talk about ASP .NET AJAX in VS 2008?
29
by: canabatz | last post by:
Hello , i got this code that works great , now i want to have it refresh every 4 seconds , where can i put the timer to do that? i realy need help!! thanx!! <script type="text/javascript">...
2
by: Chris | last post by:
I'm developing an ASP.NET Page that processes some files, does some things to them. I'd like to have a gridview that displays each file, and it's status, if it's done processing, still processing,...
22
by: canabatz | last post by:
Hi all! i got a countdown timer for auctions that runing. i got a DIV that refreshs every 4 seconds that DIV is refreshed by ajax ,the file that is refreshed is timer.php for example!! my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.