AJAX::OnSuccess network failure and status 0
Reported by Radek Pech | April 25th, 2008 @ 08:45 AM | in 1.6.1
The description of OnSuccess (Ajax.Request) says that this event is rised only for the server response 2YZ (i.e. 200, 201, etc.).
But when the request times out (e.g. server is down), it returns readyState == 4 and status == 0 and the OnSuccess is called.
To solve the timeouts, you have to use this code:
new Ajax.Request('/some_url',
{
onFailure: function(transport) {
alert('Error: '+transport.status);
}
onSuccess: function(transport) {
if (transport.status == 0) {
alert('Timeout error');
} else {
alert('Response: '+transport.responseText);
}
}
);
This collides with the advantage gain from using OnSuccess/OnFailure instead of onComplete with status testing.
Tested on FF 2.0.0.14
Comments and changes to this ticket
-
Tobie Langel April 25th, 2008 @ 11:20 AM
- → State changed from new to bug
-
Tobie Langel April 25th, 2008 @ 11:21 AM
- → Milestone changed from to 1.6.1
-
John-David Dalton April 25th, 2008 @ 12:21 PM
- → Title changed from AJAX::OnSuccess is rised after timeout to AJAX::OnSuccess network failure and status 0
- Patch here for the status 0 issue with ajax:
http://dev.rubyonrails.org/ticke...
- Patch here (is it still work in progress?) for network down detection:
http://dev.rubyonrails.org/ticke...
- Related to IE7 on local file system (Patched):
http://dev.rubyonrails.org/ticke...
- Related to 2+ yr old post about Ajax and network issues:
-
-
John-David Dalton May 29th, 2008 @ 02:44 AM
- → Assigned user changed from to John-David Dalton
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
The Prototype JavaScript library.
