[thelist] MSXML DOMDocument: Asynchronous?

Tab Alleman Tab.Alleman at realmetros.com
Mon Apr 22 11:30:01 CDT 2002


 Anyone successfully used this object asynchronously?  Willing to share
the code, or at least tell me if mine has a problem?  All I want is to
start downloading a DOMDocument asynchronously, and if it doesn't load
in a certain period of time, to forget it (and presumably do something
else).

Here's the code I'm using, but according to what I'm printing on the
screen, the readystate of the object starts at 3 and stays that way the
whole time, apparently no matter how long I wait.

<%
OPTION EXPLICIT

Dim i
i = 0
Dim GetStr

GetStr =
"http://res.amadeus.net/pl/tab/us/a.xmt?SESSION_ID=&FCT=HARA0&LANGUAGE=U
S&SITE=RMC&CAPLUS_INDICATOR=TRUE" & _

"&HOTEL_CODE=ISM524&HOTEL_CHAIN_CODE=DI&IN_DATE=20020502&OUT_DATE=200205
03&OCCUPANCY=2"

Dim xmlRoomAvail
Set xmlRoomAvail = CreateObject("msxml2.DOMDocument.4.0")
xmlRoomAvail.async = true
xmlRoomAvail.load GetStr

FOR i = 0 TO 400000
	Response.Write("<h3>ReadyState " & i & " = " &
xmlRoomAvail.ReadyState & "</h3>")
	IF xmlRoomAvail.ReadyState = 4 THEN
		Exit FOR
	END IF
NEXT

Response.Write("<h3>Debug: " & Server.HTMLEncode(xmlRoomAvail.xml) &
"</h3>")
Response.Write("<h3>i =  " & i & "</h3>")
Set xmlRoomAvail = Nothing

%>



More information about the thelist mailing list