473,396 Members | 1,772 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,396 software developers and data experts.

problem to display a "wait" message before fetching data using MS's XMLHTTP

Dear js/xmlhttp experts,

I spent hours but could not solve this problem and hope someone could
give me a clue: a onclick event will invoke a function to do a few
things:
1. make a hidden DIV "wait" message visible by changing its
style.display to "block"
2. download the data with XMLHTTP
3. make the hidden DIV message invisible by setting its display to
"none".

If I insert "alert("test")" between 1 and 2, everything works fine.
However, if I comment out "alert" statement, step 1 will happen after
step 2, which totally defeats the purpose of "wait" message. The
detailed (simplified) is below:

function downloadData {
// waitDiv below is a pre-defined global DIV object
waitDiv.style.display = 'block'; // display "please wait ..."
alert("test"); // without this, the above statement execution
seems to be delayed.

// cgiUrl and postData are global.
var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP.4.0");
xmlhttp.Open("POST", cgiUrl, false);
xmlhttp.Send(postData);
//antherDiv below is also pre-defined global DIV object.
anotherDiv.innerHTML = xmlhttp.responseText;

waitDiv.style.display = 'none'; // now hide "please wait ..."
}

I would greatly appreciate any help!!!

Alex.
Jul 20 '05 #1
1 2119
al*****@pioneer.com (Alex Li) wrote:
Dear js/xmlhttp experts,

I spent hours but could not solve this problem and hope someone could
give me a clue: a onclick event will invoke a function to do a few
things:
1. make a hidden DIV "wait" message visible by changing its
style.display to "block"
2. download the data with XMLHTTP
3. make the hidden DIV message invisible by setting its display to
"none".

If I insert "alert("test")" between 1 and 2, everything works fine.
However, if I comment out "alert" statement, step 1 will happen after
step 2, which totally defeats the purpose of "wait" message. The
detailed (simplified) is below:

function downloadData {
// waitDiv below is a pre-defined global DIV object
waitDiv.style.display = 'block'; // display "please wait ..."
alert("test"); // without this, the above statement execution
seems to be delayed.

// cgiUrl and postData are global.
var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP.4.0");
xmlhttp.Open("POST", cgiUrl, false);
xmlhttp.Send(postData);
//antherDiv below is also pre-defined global DIV object.
anotherDiv.innerHTML = xmlhttp.responseText;

waitDiv.style.display = 'none'; // now hide "please wait ..."
}

I would greatly appreciate any help!!!


You have to send the request asyncronously. See
http://jibbering.com/2002/4/httprequest.html for an example.

Regards,
Steve
Jul 20 '05 #2

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

Similar topics

1
by: deepblue | last post by:
Hi, I need to display a "please wait" message when the user click a post button on a webform, so that the webform can start data processing. I am using asp.net in vb.net code- behind. I saw some...
4
by: mvr | last post by:
Hi all Can some one give me a sample code to display a "please wait" message while retrieving results from the database in ASP. Thanks mvr
4
by: deepblue | last post by:
Hi, How to display a "Please wait" message in a webform when the webform is doing processing? The processing is initiated by user clicking a button. Thanks, Deepblue
4
by: dave | last post by:
Hi guys I display one page in popup window...that fetches some data from sql and perfom some calculation (tht approx 10 secs) and display result.... I am trying to display "Please wait ..."message...
2
by: s_erez | last post by:
Hi, This is a realy tricky one. I have an ASP.NET application where some pages are reading data from a DB and presenting reports. In order for the user to wait while the page is reading data from...
4
by: louvino | last post by:
Hi, I have some links. When I click on one, a window opens but during the loading of this window, I would like the cursor is in state "wait" (using CSS : cursor : wait; ) Help me :-)
13
by: Abhishek Bhatt | last post by:
How can I display a friendly "please wait" message to the user, while running a time consuming module at the back end?
5
by: Jeremy | last post by:
Hi all, I have database actions that will potentially take several seconds to complete. My normal page uses AJAX so keeping the user informed of what is happening is not a problem. ...
1
by: =?Utf-8?B?Sm9obiBXYWxrZXI=?= | last post by:
Hi, I have a webpage designed with asp.net 2.0. Is there a way to display a "please wait" message to the screen horizontally centered and veritcally 20px from the VISIBLE top of the page,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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.