Hi,

I don't know why status 0 is considered "success" in Prototype (this
has been noted before[1]).  I'll be interested in whether a core dev
chimes in with an explanation for that.  As Doug Reeder points out in
the link above, status 0 happens on some browsers when the 'net
connection is down.

But leaving aside status 0, just a logical point.  The third condition
in your updated code:

>     return (status >= 200 && status < 300 && status != 0); <--------

...is irrelevant and will never be evaluated.  If 200 <= x < 300, x
cannot be zero.  To remove the part about status 0 being success, just
remove it, you don't have to tack anything further on:

    return (status >= 200 && status < 300);

[1] http://proto-scripty.wikidot.com/prototype:how-to-bulletproof-ajax-requests

FWIW,
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available

On Jul 13, 10:34 am, Rick <dun...@googlemail.com> wrote:
> I have googled for Ajax Request Timeout, but i didn't finde a good
> working solution.
>
> These both are for most people the best solutions.
>
> http://positionabsolute.net/blog/2008/07/prototype-ajax-request-timeo...http://codejanitor.com/wp/2006/03/23/ajax-timeouts-with-prototype/
>
> But these solutions just work half, it worked under IE8 but not under
> FF3
>
> I tried to fix it my self, so i fixed the problem that under firefox,
> always the onSuccess comes, even if the server is
> down.
>
> ---- prototype.js   line: 1494 ------------------------------
>   success: function() {
>     var status = this.getStatus();
>     return !status || (status >= 200 && status < 300);
> <---------------- maby the problem
>   },
>
> ---- prototype.js   line: 1494 changed ------------------
>   success: function() {
>     var status = this.getStatus();
>     return (status >= 200 && status < 300 && status != 0); <--------
> works got a onFailure event, if server is down
>   },
> ------------------------------------------------------------------------
>
> after this fix i have a correct onFailure event in FF, IE and Opera.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to