Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 28th, 2007, 11:50 AM
Registered User
 
Join Date: Feb 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Why is readyState always 1? sqad Ajax 5 April 29th, 2008 07:35 PM
Always getting readyState = 1 CraigMuckleston PHP How-To 0 June 15th, 2007 10:55 AM
readyState not ready -- closed see google groups scottradny BOOK: Professional Ajax ISBN: 978-0-471-77778-6 1 March 30th, 2006 11:55 AM
Loop and move next surendran PHP How-To 3 July 27th, 2004 12:17 PM
Help me! move database smily Oracle 3 June 27th, 2004 08:18 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.