brettr
asked on
Loading image for async call
I'm using an XMLHttpRequest call and want to display a loading or similar animation image while waiting. Here's the psuedo code I'm using:
xReq = new XMLHttpRequest()
xReq.open(...)
xReq.onreadystatechange = function(){..poll state..}
text = xReq.responseText
Is there a pattern for displaying the image? Any code examples?
xReq = new XMLHttpRequest()
xReq.open(...)
xReq.onreadystatechange = function(){..poll state..}
text = xReq.responseText
Is there a pattern for displaying the image? Any code examples?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
How do I get the div to appear basically in the middle of the page on top of everything else? Is there a way to gray out the stuff behind this div?
try something like this to show the div on center of page
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style>
#outerdiv {position:absolute;top:50% ;left:50%; overflow:s how;}
#innerdiv {position:absolute;top:-(5 0% of your height);left:-(50% of your width);}
</style>
</head>
<body>
<div id="outerdiv">
<div id="innerdiv">
<p>Hello world</p>
</div>
</div>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style>
#outerdiv {position:absolute;top:50%
#innerdiv {position:absolute;top:-(5
</style>
</head>
<body>
<div id="outerdiv">
<div id="innerdiv">
<p>Hello world</p>
</div>
</div>
</body>
</html>
An example of it with code can be found:
http://extjs.com/deploy/dev/examples/form/xml-form.html