Hi,

> In the currently latest version of prototype.js
> ...
> there is no def for onSuccess?  yet when I use
>
> Ajax.Request(url, { onSuccess : function(r) { ... }    it works...
>
> So is it defined some where else?

Yes, *you're* defining it (above).  Prototype calls it.

> I was mainly looking for the conditions of success, because Jeremy
> Keith in his book Bulletproof AJAX says that the status of 200 and 304
> both should be considered a success.
> ...
> There is a check in prototype
> ...
> but it doesn't include 304.  Does someone know?  Many thanks!

I'd never thought about 304.  304 (for anyone else reading this who
hasn't memorized HTTP response codes) is the "not modified" response,
meaning a conditional GET has been performed and the local copy is
still fresh:
http://www.w3.org/Protocols/rfc2616/rfc2616.html
Response 304 is not allowed to contain a body; the point is to get the
body from cache if you see a 304.

It appears that most browsers translate a 304 into a 200 and supply
the cached body for our code, which I (for one) greatly appreciate,
that seems like the appropriate layer to handle that as they will have
the cache and we won't. :-)  I found this interesting page:
http://www.mnot.net/javascript/xmlhttprequest/cache.html
...which says it tests caching and XHR on the browser you're using,
and has a specific test for this 304 situation.  I tested a few using
it:  IE6, FF3, and Safari 3.1 for Windows all translated the 304 into
a 200 nicely.  The test failed on Opera 9 (says it got back a status
code of 0), but whether that indicates a problem with Opera 9 or the
author's testing code I haven't looked into.

liketofindoutwhy:  (Do you have a name?)  If you google
"httpxmlrequest 304" (without the quotes), you'll find lots of
discussion of the 304 vs. 200 issue.

HTH,
--
T.J. Crowder
tj / crowder software / com

On Sep 9, 12:31 am, liketofindoutwhy <[EMAIL PROTECTED]>
wrote:
> In the currently latest version of prototype.js
>
> http://www.prototypejs.org/assets/2008/1/25/prototype-1.6.0.2.js
>
> there is no def for onSuccess?  yet when I use
>
> Ajax.Request(url, { onSuccess : function(r) { ... }    it works...
>
> So is it defined some where else?
>
> I was mainly looking for the conditions of success, because Jeremy
> Keith in his book Bulletproof AJAX says that the status of 200 and 304
> both should be considered a success.  He says some version of Opera
> does a conditional GET to check whether the page in cache is up to
> date, and if it is, then the status 304 is returned instead of 200.
>
> Thought, when I try the latest version of Opera using the most basic
> form of AJAX (XmlHttpRequest or the Microsoft ActiveX), then I only
> see a 200 status, never a 304.
>
> There is a check in prototype
>
>   success: function() {
>     var status = this.getStatus();
>     return !status || (status >= 200 && status < 300);
>   },
>
> but it doesn't include 304.  Does someone know?  Many thanks!
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to