Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > BOOK: Professional Ajax ISBN: 978-0-471-77778-6
BOOK: Professional Ajax ISBN: 978-0-471-77778-6
This is the forum to discuss the Wrox book Professional Ajax by Nicholas C. Zakas, Jeremy McPeak, Joe Fawcett; ISBN: 9780471777786
Important: For the new 2nd edition of this book, please post here instead: [url="http://p2p.wrox.com/forum.asp?FORUM_ID=307"]http://p2p.wrox.com/forum.asp?FORUM_ID=307[/url]
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Ajax ISBN: 978-0-471-77778-6 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 March 29th, 2006, 11:39 AM
Registered User
Join Date: Mar 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default readyState not ready -- closed see google groups

I have written some code that creates one xmlhttp object and shares it among different functions. My problem is that I can get the code to run in IE but not Firefox when the asynchronicity is set to false and I use post. If I set asynchronicity to true then for some reason the httpreadyState is not ready and I get back either a 1 or 3 as a response code in both browsers, but if I add an alert within the code at the end of my loop, then readyState succeeds. Problem is that I don't want the alert in there as it kills my whole AJAX app usability. I have some code below to demonstrate.
Help is appreciated.

<div align="left">

function getItAll() {
//This responseText is from another method.
var resultz = http.responseText;

//This looks at how many urls are in my data.
var num = countInstances(resultz, '<!--URL');

/*This is where I loop through the response text and get some data that I want to use in handleHttpResponse. The handleHttpResponse will look at the data(a url) and get information from it. All files(urls) are on the same server.*/
for (j=0; j < num;j++) {

var urlToCompare = resultz.substring(resultz.indexOf('<!--URL' + j + '#')+9);

var urlToCompare = urlToCompare.substring(urlToCompare,

http.open('POST', urlToCompare, true);


http.onreadystatechange = handleHttpResponse;

//Sending a random param to prevent caching.
http.send('?ms=' + new Date().getTime());

/*If I don't add this alert my readyState doesnt get to 4 and so my handleHttpResponse will not run or at least one just once and then die. It seems that by adding this alert I give the request/code a chance to catch up with itself. */

////////////END CODE
</div id="left">
Old March 30th, 2006, 11:55 AM
Registered User
Join Date: Mar 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts

Topic has been moved to http://groups.google.com/group/ajax-...0f34eb6c65f726

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 won't move from 1 to 2! lmireskandari Javascript 0 February 28th, 2007 11:50 AM
Check if drive is ready or not uday_mandava General .NET 0 February 15th, 2007 04:27 PM
test if Frame is ready... darkhalf Javascript 1 September 19th, 2006 05:00 AM

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