readyState won't move from 1 to 2!
Hi there,
I am using XMLHTTP to make a request (on page1) to page2 and on page2 I am again using XMLHTTP to make another request (sending an XML request along) to page3.
the code looks similar to the following:
Page1:
var objXMLHTTP = new ActiveXObject("MSXML2.XMLHTTP");
var sUrl = "http://....."
objXMLHTTP.onreadystatechange= function () {
DebugToFile("ObjectivesReadyState:" + objXMLHTTP.readyState);};
objXMLHTTP.Open("GET",sUrl,false);
objXMLHTTP.send("");
Page2:
var xmlRequest = Server.CreateObject("Microsoft.XMLDOM");
xmlRequest.async = false;
...
(building xmlRequest)
...
var oPoster = Server.CreateObject("Microsoft.XMLHTTP");
oPoster.onreadystatechange= function () {
DebugToFile("readyState:" + oPoster.readyState);};
oPoster.open("POST", sURL, false);
oPoster.send(xmlRequest);
"DebugToFile" function just writes the readyState into a debug text file for me.
The problem I am facing is that in a very inconsistent maner, sometimes!, both requests go through all the readyStates from 1 to 4 (and the application works fine)and some other times! the second request does not get from state 1 to 2 and the application kinda gets stuck in the middle of the second request.
This is what I get on the debug file:
when works fine:
ObjectivesReadyState:1
ObjectivesReadyState:1
readyState:1
readyState:1
readyState:2
readyState:3
readyState:4
ObjectivesReadyState:2
ObjectivesReadyState:3
ObjectivesReadyState:4
when gets stuck:
ObjectivesReadyState:1
ObjectivesReadyState:1
readyState:1
readyState:1
I would appreciate any thoughts on this matter. It is just driving me nuts!
|