Hi,

I have a question regarding the code in Ajax.Request.  Specifically,
the "success" and "getStatus" methods.

Here is the code from the latest version for reference:

<pre>
<code>
  success: function() {
    var status = this.getStatus();
    return !status || (status >= 200 && status < 300);
  },

  getStatus: function() {
    try {
      return this.transport.status || 0;
    } catch (e) { return 0 }
  },
</code>
</pre>

In getStatus, it looks like 0 is returned if the current transport's
status is null, undefined or somehow returned as false.  In the
success method, the negation of the status is checked for validity; !0
evaluates to true, so if no status defined, the request is deemed
successful.

During a recent project, I ran a test in which I shut down my
application server, and then tried to invoke an Ajax call.  In Firefox
3, the underlying transport actually returned a 0 for its status, so
the call was evaluated as being successful, and the corresponding
callback method was invoked.

Given all this, I would like to know whether a 0 status should be
construed as being a successful request.  I have not found any
reference to it in HTTP status definitions online.  Also, under what
cases do transports not return any status, and are these cases also to
be construed as being successful?  Or...am I missing something else
that is at work here?

Any thoughts and insights are greatly appreciated -- thanks in
advance!

Cheers,

Cliff

--~--~---------~--~----~------------~-------~--~----~
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