473,398 Members | 2,404 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,398 software developers and data experts.

XmlHttp (Ajax) Show Waiting Message

Hi

I have a form that submits to a web service.
As this takes time, i would like to show the user a loading message while
its loading.
I am using XmlHttp to do the request
How can i show this waiting message.
No matter what i do, it waits till everythings loaded before doing anything.

Currently:

<SCRIPT language="javascription">

function ButtonClick()
{
ShowLoadingMessage();
SubmitXmlHttpRequest();
}

function ShowLoadingMessage()
{
document.getElementById('statusmessage').innerHTML = 'Loading ...';
}

var xhttp;

function SubmitXmlHttpRequest()
{
xhttp = new ActiveXObject("Msxml2.XMLHTTP");
xhttp.onreadystatechange = GetXmlHttpResult;
xhttp.open("GET", http://mydomain.com/WebPageThatDoesProcessing,
false);
xhttp.send();
}

function GetXmlHttpResult()
{
if ( xhttp.readyState == 4 )
document.getElementById('statusmessage').innerHTML = 'Submitted';
}

</SCRIPT>

TIA
Jan 10 '06 #1
2 3778
for the browser to update the display it needs to run a windows look
(doevents). you go into a hard loop and prevent this. try:

function ButtonClick()
{
ShowLoadingMessage();
window.setTimeout("SubmitXmlHttpRequest();",1);
}

-- bruce (sqlwork.com)

"Grant Merwitz" <gr***@workshare.com> wrote in message
news:O8**************@tk2msftngp13.phx.gbl...
Hi

I have a form that submits to a web service.
As this takes time, i would like to show the user a loading message while
its loading.
I am using XmlHttp to do the request
How can i show this waiting message.
No matter what i do, it waits till everythings loaded before doing
anything.

Currently:

<SCRIPT language="javascription">

function ButtonClick()
{
ShowLoadingMessage();
SubmitXmlHttpRequest();
}

function ShowLoadingMessage()
{
document.getElementById('statusmessage').innerHTML = 'Loading ...';
}

var xhttp;

function SubmitXmlHttpRequest()
{
xhttp = new ActiveXObject("Msxml2.XMLHTTP");
xhttp.onreadystatechange = GetXmlHttpResult;
xhttp.open("GET", http://mydomain.com/WebPageThatDoesProcessing,
false);
xhttp.send();
}

function GetXmlHttpResult()
{
if ( xhttp.readyState == 4 )
document.getElementById('statusmessage').innerHTML = 'Submitted';
}

</SCRIPT>

TIA

Jan 10 '06 #2
Thanks Bruce, i'll give that a try.

I had previously tried 'setTimeout',
but not 'window.setTimeout'

"Bruce Barker" <br******************@safeco.com> wrote in message
news:eP**************@TK2MSFTNGP12.phx.gbl...
for the browser to update the display it needs to run a windows look
(doevents). you go into a hard loop and prevent this. try:

function ButtonClick()
{
ShowLoadingMessage();
window.setTimeout("SubmitXmlHttpRequest();",1);
}

-- bruce (sqlwork.com)

"Grant Merwitz" <gr***@workshare.com> wrote in message
news:O8**************@tk2msftngp13.phx.gbl...
Hi

I have a form that submits to a web service.
As this takes time, i would like to show the user a loading message while
its loading.
I am using XmlHttp to do the request
How can i show this waiting message.
No matter what i do, it waits till everythings loaded before doing
anything.

Currently:

<SCRIPT language="javascription">

function ButtonClick()
{
ShowLoadingMessage();
SubmitXmlHttpRequest();
}

function ShowLoadingMessage()
{
document.getElementById('statusmessage').innerHTML = 'Loading
...';
}

var xhttp;

function SubmitXmlHttpRequest()
{
xhttp = new ActiveXObject("Msxml2.XMLHTTP");
xhttp.onreadystatechange = GetXmlHttpResult;
xhttp.open("GET", http://mydomain.com/WebPageThatDoesProcessing,
false);
xhttp.send();
}

function GetXmlHttpResult()
{
if ( xhttp.readyState == 4 )
document.getElementById('statusmessage').innerHTML =
'Submitted';
}

</SCRIPT>

TIA


Jan 11 '06 #3

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

Similar topics

6
by: Vanessa | last post by:
I have a question regarding async mode for calling Microsoft.XMLHTTP object. Microsoft.XMLHTTP hangs the IE once in a while suddenly, but it will work again after half an hour or so without doing...
1
by: Ike | last post by:
Ive copied an online example for writing out a php file, programmatically, then would like to re-display that data in a browswer window that automatically refreshes as the data file (getdata.php,...
3
by: Noozer | last post by:
Hrm.. last posting was mangled. Let's try again, with more detail... I'm just starting to try out "Ajax" web programming and I've got a question. AJAX is fairly straightforward. Javascript...
14
by: FMDeveloper | last post by:
Currently transitioning from a shared host to a dedicated server. The same code that works on the old server is not working on the dedicated server. It is a simple AJAX request like: <code>...
4
by: sirjohnofthewest | last post by:
If I possessed the power to sway the mind of every user in the world to delete all forms of Internet Explorer I would die a happy man. Hi guys, I frequently visit this site to get answers to my...
1
by: farghal | last post by:
Hello as many people I'm new to ajax but trying my best to understand. At this point I got a problem I'm not able to solve. I've looked on several forums and googled internet but I can't find a...
2
by: Jay | last post by:
Getting into AJAX using the XMLHttp object and am really liking it. We are in the process of upgrading our existing behavior calls (webservice.htc) to the more 'supported', as they say, concept...
21
vikas251074
by: vikas251074 | last post by:
I am getting error while entry in userid field. When user enter his user id, an event is fired immediately and user id is verified using AJAX method. But I am getting error 'Object doesn't support...
1
by: StevenS | last post by:
Ok, I'm very new to AJAX programming, and fairly new to Javascript. (I was originally trained on low-level C programming.) I'm trying to build a simple AJAX routine in a file named ajax.js: ...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.