/    Sign up×
Community /Pin to ProfileBookmark

xmlhttp.readyState==4 || xmlhttp.readyState=="complete"

After [url=http://www.hunlock.com/blogs/Concurrent_Ajax]this encounter[/url] and one of my google [url=http://www.google.com/codesearch?hl=en&q=+%5B%5Cw%5C.%5D%2B%5C.readyState%3D%3D4%5Cs*%5C%7C%5C%7C%5Cs*%5B%5Cw%5C.%5D%2B%5C.readyState%3D%3D%22complete%22]code searches[/url] I couldn’t help but wonder, “Is there [i]really[/i] a browser out there that enumerates the readyState property of the XMLHttpRequest object, or equivalent, in such a way that it [i]actually[/i] uses strings instead of numbers?”
Is this some kind of conventional mishap that was born due to [url=http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/readyState_1.asp]myElement.readyState[/url] using strings?

to post a comment
JavaScript

7 Comments(s)

Copy linkTweet thisAlerts:
@pcx99Jan 23.2007 — It's a holdover from the DOM event, a sort of catchall because the "official" documentation indicates one thing for the DOM and a different behavior for the xmlhttp objects. It should safe to leave off the "complete" check for the xmlhttprequest objects.

http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/readyState_1.asp
Copy linkTweet thisAlerts:
@UltimaterauthorJan 23.2007 — So it [i]is[/i] a conventional mishap after all? Can't blame Microsoft's documentation for it since it does state "Applies To" at the bottom of the page for clarity.

[url=http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/readyState_3.asp]XMLHttpRequest.readyState[/url] (Integer)

[url=http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/readyState_2.asp]OBJECT.readyState[/url] (Integer)

[url=http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/readyState_1.asp]object.readyState[/url] (String)

Hmph...
Copy linkTweet thisAlerts:
@A1ien51Jan 23.2007 — Stop trying to save the world! ? Mr AHAH! :p

Eric
Copy linkTweet thisAlerts:
@UltimaterauthorJan 23.2007 — Stop trying to stop me from saving the world Eric. ?

Woot... I just realized that pcx99's home page, according to his profile, is the same website as my xmlhttp.readyState=="complete" encounter. Pcx, you the writer of http://www.hunlock.com/blogs/Concurrent_Ajax ? Must've found my post on google linking to your site, eh?
Copy linkTweet thisAlerts:
@pcx99Jan 23.2007 — Stop trying to stop me from saving the world Eric. ?

Woot... I just realized that pcx99's home page, according to his profile, is the same website as my xmlhttp.readyState=="complete" encounter. Pcx, you the writer of http://www.hunlock.com/blogs/Concurrent_Ajax ? Must've found my post on google linking to your site, eh?[/QUOTE]


I admit it, I'm the author ? Although I've written a better module since in "Ajax for everyone". Concurrent is nice when you want to load data directly into layers but innerHTML is highly inefficient so I upgraded the routine to pass the responseText directly to the callback function.

I actually just saw it show up on the referrer logs before I headed to bed. If you want to find interesting sites on the net write tech articles and see who links to them ?
Copy linkTweet thisAlerts:
@A1ien51Jan 23.2007 — My favorite thing is in the spec document they have the onreadystate before the open! It does not matter since they "create" a new object before use and the code is Native only. The open method is "Supposed" to reset the other values.

Eric
Copy linkTweet thisAlerts:
@UltimaterauthorJan 24.2007 — I admit it, I'm the author ? Although I've written a better module since in "Ajax for everyone". Concurrent is nice when you want to load data directly into layers but innerHTML is highly inefficient so I upgraded the routine to pass the responseText directly to the callback function.[/QUOTE]
Hmm... Patrick is it? looks a lot like something I submitted at http://javascript.internet.com/ajax/ajax-navigation2.html
<i>
</i>onclick="open_url('page-1.html','my_site_content');"

The big difference being that I am re-using the same xmlhttp object instead of creating a new one each request and deleting the object or aborting it. Then your script proves useful for allowing cross-domain request since you are using the readfile() within showtext.php enabling you to "steal" content from other sites.

Eric did mention the order of open and onreadystatechange. It is worth knowing that IE glitches-out when onreadystatechange is assigned a function prior to calling open and you will run into [url=https://webdeveloper.com/forum/showthread.php?p=667653#post667653]this problem[/url] however this is only an issue if you are gonna re-use the XHR object.
×

Success!

Help @Ultimater spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...