John Resig schrieb:
>> John, thanks for documenting all the stuff! But to be honest, I still
>> have no clue, how to use $.ajaxTimeout properly. Obviously, it times out
>> any pending connections but how can I react on that?
>>
>> What I try is to show the user a message like "Connection to the server
>> has been lost".
>> Anybody out there with a simple code sample? :)
> 
> Oh - sorry about that, something like this:
> 
> $.ajaxTimeout( 5000 );
> 
> $.ajax({
>     url: "doesnotexist.html",
>     error: function( req, msg ) {
>         if ( msg == "timeout" )
>             alert( "Connection to server lost." );
>     }
> });
> 
> I'm realizing now that I pass the message in to the second argument -
> it should be the first. I'll change that in a later version, but it's
> nothing major. Hope that helps.
> 
> --John


The timeout is global, right? Maybe this gives some more flexibility:

$.ajax({
     ...
     timeout: 5000, // overrides $.ajaxTimeout
     ....
});

What do you think?


-- klaus

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to