I believe onFailure is only a callback method for errors that happen on
the server (you would have to have caught some kind of error condition
in the server side code and explicitly initiated the onFailure method in
your response), not on the client during the attempted transport/request
to the server...

I think what you want is:

try
{
        new Ajax.Request('non_existant.file', {
                onSuccess:function(){alert("yay");},
                onFailure:function(){alert("boo");}
        });
}
catch (e)
{
        doSomething();
}

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Douglas Livingstone
Sent: Tuesday, February 14, 2006 10:49 AM
To: rails-spinoffs@lists.rubyonrails.org
Subject: [Rails-spinoffs] onFailure fails?

Hi all,

I have this code:

new Ajax.Request('non_existant.file', {
        onSuccess:function(){alert("yay");},
        onFailure:function(){alert("boo");}
        });

Why does the onFailure alert never get called? It works fine if I use
a real file (onSuccess gets called).

Thanks,
Douglas
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

The information transmitted in this electronic mail is intended only for the
person or entity to which it is addressed and may contain confidential,
proprietary, and/or privileged material.  Any review, retransmission, 
dissemination or other use of, or taking of any action in reliance upon,
this information by persons or entities other than the intended recipient
is prohibited. If you received this in error, please contact the sender and
delete the material from all computers.

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to