Well since 4.0 is a beta version I suggest you downgrade to 3.1 and
use this one as onFailure works just fine on the stable release.

If you really want to use 4.0, try adding onComplete and do a switch
statement against the response headers.

Best,
Oskar

On Dec 9, 12:20 pm, Yanson <[EMAIL PROTECTED]> wrote:
> I'm using a JSON request to verify login credentials (although I
> intend on using JSON all over the 'site').
> When I turn off the web server to verify catching the failure, Safari
> does not fire the event. It just puts an error in the status bar to
> look in the activity log which shows could not find host.
> Firefox does fire the onFailure event.
>
> Here is the code, hope you can help me, it's for my final year
> project.
>
> BTW I'm using OS X 10.5 and Safari Version 4.0 (5528.1) from the
> developer site.
>
> Iain
>
> var myRequest = new Request.JSON({
>                 onSuccess:function(j,s){
>                         if(!j || !j.status) {
>                                 alert('The server returned an unexpected 
> result. \nThe result
> follows...');
>                                 alert(s);
>                                 return;
>                         }
>                         if(j.status=='BAD_USER') {
>                                 //alert("The server responded with the 
> following error:\n" +
> j.error);
>                                 feedback_error(j.user_feedback,2500);
>                         }
>                         else if (j.status=='OK'){
>                                 session.user = j.user;
>                                 page_load(pages.summary);
>                         }
>                         else {
>                                 alert('The server returned an unexpected 
> result. The result
> follows.');
>                                 alert(s);
>                         }
>                 },
>                 onFailure:function(){
>                         alert('Could not connect to the server. Have you got 
> an internet
> connection?');
>                 }
>         });
>         myRequest.send($('page_login').toQueryString());

Reply via email to