AJAX::OnSuccess network failure and status 0
Reported by Radek Pech | April 25th, 2008 @ 10: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 @ 01:20 PM
- → State changed from new to bug
-
Tobie Langel April 25th, 2008 @ 01:21 PM
- → Milestone changed from to 1.6.1
-
John-David Dalton October 28th, 2008 @ 07:22 PM
- → Assigned user changed from to Tobie Langel
- → Title changed from AJAX::OnSuccess is rised after timeout to AJAX::OnSuccess network failure and status 0
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.
