Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > BOOK: Professional Ajax ISBN: 978-0-471-77778-6
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 29th, 2006, 11:39 AM
Registered User
 
Join Date: Mar 2006
Location: , , .
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">
/////BEGIN CODE

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,
urlToCompare.indexOf('#URL-->'));

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

http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');

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. */
alert('test');
   }

}
////////////END CODE
</div id="left">
Reply With Quote
  #2 (permalink)  
Old March 30th, 2006, 11:55 AM
Registered User
 
Join Date: Mar 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 04:53 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.