it's actually really strange and has gone beyond the scope of my js
knowledge!
Take a look at this code (may be syntax errors as it's from memory):

Ajax.Responders.register({
      onCreate: function(request, response)
      {
        request.url = 'somewherethatdoesntexist.php';

        var specificOnFailure = request.options.onFailure;
        request.options.onFailure = function()
{ specificOnFailure(); };

        // show the ajax loading element
        $('ajax-loading').show().highlight();
      }.bind(this),

      onException: function()
      {
        document.fire("event:madness", "I have no idea why this
fired!");
      }
});

the onException fires then, but not if the two lines starting with var
specificOnFailure are removed! WTF?!!!

I'm already doing exactly what you've suggested and testing directly
against the status code now, that seems to be doing the job, but not
as neatly as a registered callbacks to onXYZ's would.

Anyway, there's certainly still an element of confusion here! Would be
nice to have some kind of further explanation in the otherwise
excellent API.



On Sep 9, 2:52 pm, "Justin Perkins" <[EMAIL PROTECTED]> wrote:
> On Tue, Sep 9, 2008 at 8:05 AM, bluezehn <[EMAIL PROTECTED]> wrote:
> > - but right now I can't register an onFailure.
>
> Maybe it's just not getting invoked when you are expecting it to? You
> might want to use the onException callback instead, or even have a
> global onComplete handler and then within that method you can check
> the status and handle appropriately. The reason I say this is because
> onFailure and onException do not get invoked *all* the time, vs.
> onComplete does.
>
> -justin
--~--~---------~--~----~------------~-------~--~----~
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