I'm using the XMLHTTPRequest JavaScript object to fetch updated info
from the server.
The problem I'm having occurs on Windows 2000/IE 6. There is a very
long pause on readyState 3 (close to a minute, maybe more) but it
eventually gets to readyState 4. I have no idea why. The page works
just fine on Windows XP/IE 6.
There is no delay or hang up on the server side as far as I can tell
(if we get to readyState 3 is because the server already sent its
response).
Does anyone know what takes place between readyState 3 and 4 and why
does this happen on Windows 2000 but not on Windows XP?
Any input will be greatly appreciated.
Here's the code for illustration purposes.
var xmlobj=null;
var data=new Array();
function sendRequest(doc )
{
// check for existing requests
if( xmlobj != null && xmlobj.readySta te != 0 && xmlobj.readySta te !=
4 )
{
xmlobj.abort();
}
xmlobj = createXMLHttpRe quest(); //my own library function to create
object
xmlobj.onreadys tatechange=stat eChecker;
xmlobj.open('GE T',doc,true);
xmlobj.setReque stHeader("Cache-Control", "no-cache");
xmlobj.setReque stHeader("If-Modified-Since", "Wed, 31 Dec 1980
00:00:00 GMT");
xmlobj.setReque stHeader("Expir es", "Wed, 31 Dec 1980 00:00:00 GMT");
xmlobj.setReque stHeader("Conne ction", "close");
xmlobj.send(nul l);
}
function stateChecker()
{
alert( "stateCheck er: xmlobj.readySta te = " + xmlobj.readySta te );
if( typeof(xmlobj) != "undefined" && xmlobj != null &&
xmlobj.readySta te == 4 )
{
if(xmlobj.statu s == 200)
{
data=xmlobj.res ponseText.split ('\n');
displayData();
}
else if( xmlobj.status != 0 )
{
alert("Failed to get response: "+ xmlobj.status + " - " +
xmlobj.statusTe xt);
}
}
}
function displayData()
{
//Dynamically re-draw page here.
} 2 3642
coolvirus wrote:
function stateChecker()
{
alert( "stateCheck er: xmlobj.readySta te = " + xmlobj.readySta te );
if( typeof(xmlobj) != "undefined" && xmlobj != null &&
xmlobj.readySta te == 4 )
{
if(xmlobj.statu s == 200)
{
data=xmlobj.res ponseText.split ('\n');
displayData();
}
else if( xmlobj.status != 0 )
{
alert("Failed to get response: "+ xmlobj.status + " - " +
xmlobj.statusTe xt);
}
}
else {
return false;
}
}
This should fix your problem, most likely.
James,
Thank you very much for the reply but it didn't work. Still hanging on
readyState 3.
James Black wrote:
coolvirus wrote:
function stateChecker()
{
alert( "stateCheck er: xmlobj.readySta te = " + xmlobj.readySta te );
if( typeof(xmlobj) != "undefined" && xmlobj != null &&
xmlobj.readySta te == 4 )
{
if(xmlobj.statu s == 200)
{
data=xmlobj.res ponseText.split ('\n');
displayData();
}
else if( xmlobj.status != 0 )
{
alert("Failed to get response: "+ xmlobj.status + " - " +
xmlobj.statusTe xt);
}
}
else {
return false;
}
}
This should fix your problem, most likely.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Gaz |
last post by:
In Internet Explorer 6 I'm having a problem with the httprequest
object. I use it to call a webservice and display the result in the
readystate event handler. This works the first time I call it but
subsequently the readystate event handler function is never called, or
the event itself is never fired.
The same code works fine in Firefox. Changed it around a lot to no
effect Can anyone help?
I'm not supposed to create a new...
|
by: Matt Kruse |
last post by:
I'm aware of the circular reference memory leak problem with IE/closures.
I'm not sure exactly how to resolve it in this situation. Also, Firefox
appears to grow its memory size with the same code. So I'm wondering if I'm
missing something?
My test code is as follows:
function myObj() {
var req = new Object();
req.temp = 0;
|
by: jason.lucey |
last post by:
Hi,
I need some help figuring this out. I cannot get the xmlhttprequest
object to return responseXML or getAllResponseHeaders. responseText
works fine, but i'd rather use xPath than regular expressions to
populate some tables.
I'm using the XMLHttpRequest object for Mozilla and the
ActiveXObject("Msxml2.XMLHTTP") for IE.
|
by: Matt Kruse |
last post by:
According to HTTP/1.1 specs, a client should only have two connections open
to the host at a time (which can be changed by browser users, of course).
When using xmlHttpRequest connections, is there any way to detect that the
request is queued?
I did some tests (see "Queued Requests" at
http://www.ajaxtoolbox.com/request/examples.php ) and it looks like
readyState 1 is fired immediately after the request is made, even though
it's not...
|
by: Nathan |
last post by:
Can I run two XMLHTTPRequest objects at the same time? Im able to get
one to work without problems.
If I put a call to a function inside the first ones onreadystatechange
function, the 2nd ones readyState is always set to 1 (loading). Ive
tried using the same XMLHTTPRequest object, and making a 2nd
XMLHTTPRequest object with the same results. Heres my code thats giving
me problems...
function RefreshChat() {
| |
by: geevaa |
last post by:
http://www.phpbuilder.com/columns/kassemi20050606.php3
XMLHttpRequest and AJAX for PHP programmers
James Kassemi
Introduction:
Although the concept isn't entirely new, XMLHttpRequest technology is
implemented on more sites now than ever. Compatibility is no longer an
issue (IE, Mozilla and Opera all support it), and the benefits to
using it are amazing. There are too many PHP programmers avoiding any
|
by: HugeBob |
last post by:
Hi All,
I've got a question about Asynchronous vs Synchronous mode with the
XMLHttpRequest object. What are the ramifications of using one mode
vs the other? If the script uses Asynchronous mode, it sounds as if a
thread retrieves the data from the supplied URL and the JS function
that called the open() and send() methods continues on. Where as
using Synchronous mode the method that called open() and send() waits
until the data from...
|
by: rpjd |
last post by:
I am having a problem getting the http.status of an xmlhttprequest. The request readystate has come back as readystate 4, but then it stops without confirming the http.status. Any help appreciated.
<script type="text/javascript" >
var postring = "?";
function string()
{
var first = document.numbers.first.value;
var second = document.numbers.second.value;
var third = document.numbers.third.value;
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |