An ajax revamp is planned for 2.0. Best,
Tobie On Aug 18, 4:55 pm, Ken Snyder <[email protected]> wrote: > Yes! The core devs do need to address whether or not this > Ajax.Request#getStatus() behavior will be fixed. > All non-HTTP requests (namely file:) return a status of 0. A function like > the following needs to be added, probably in Ajax.Request#getStatus() > > isHttp: function() { > var pcol = String(this.url).match(/^([a-z]+)?\:/i); > if (!pcol) { > return window.location.protocol.match(/^https?\:/); > } > if (pcol[1] == 'http') { > return true; > } > > }, > > In my opinion, the status should be zero only on failure and an > onNetworkError or the like should be fired in place of on0 (Firing on0 > seems kludgey). Other error status codes (such as 12002, 12007, 12029, > 12030, 12031, 12152 and 13030) need to be mapped to a status of 0 and fire > onNetworkError (see "Ajax: the Complete Reference" by Thomas Powell > -http://books.google.com/books?id=p9hrjVMAeYkC&pg=PA180) > > Then, as you mentioned, Ajax.Request#success() would then be return > (status> = 200 && status <300); > > With the current state of Prototype, you'll need to manually interpret a > success as a failure when the request is HTTP. > > - Ken > > On Fri, Jul 17, 2009 at 4:15 AM, T.J. Crowder <[email protected]>wrote: > > > > > > > > Looks like success() returns TRUE all the time as foolged said. > > > Yes, if getStatus returns 0 (either because the HTTP status code > > really came back from the browser as 0, or because the browser didn't > > supply one at all), then success will return true. This has been > > noted before.[1][2] > > > I'd love to hear from one of the core devs (NOT just someone active on > > this list like myself) *why* zero is considered success, because it > > doesn't make sense to me. The server being offline is certainly not a > > successful outcome. Most of the contributors to Prototype are not > > dumb, it's there for a reason, I just want to know what the reason is > > since they didn't feel it deserved a comment in the source. > > > [1] > >http://proto-scripty.wikidot.com/prototype:how-to-bulletproof-ajax-re... > > [2] > >http://groups.google.com/group/prototype-scriptaculous/browse_thread/... > > -- > > T.J. Crowder > > tj / crowder software / com > > Independent Software Engineer, consulting services available > > > On Jul 16, 1:52 pm, dmitrymos <[email protected]> wrote: > > > Alex, what does success() return if getStatus() returns 0 in case of > > > error? > > > > Looks like success() returns TRUE all the time as foolged said. > > > > On Jul 16, 7:37 am, "Alex McAuley" <[email protected]> > > > wrote: > > > > > as it states....... > > > > > Return !status (NOT STATUS) || (OR) status greater than or equal to 200 > > > > (TRUE|FALSE) && status LESS THAN 300 > > > > > as i said again it returns a true false > > > > > ----- Original Message ----- > > > > From: "foolged" <[email protected]> > > > > To: "Prototype & script.aculo.us" < > > [email protected]> > > > > Sent: Thursday, July 16, 2009 10:42 AM > > > > Subject: [Proto-Scripty] Re: checked !status in line 1496? > > > > > (prototype-1.6.1.RC3) > > > > > > Hi All > > > > > You do not understand my question. > > > > > I asked, not what is returned. > > > > > I asked what is checked! status? > > > > > > IMHO rightly so. > > > > > return (status> = 200 & & status <300); --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
