I tried using the timeout option on $.ajax and it just didn't seem to
work.

I think I tracked it down, since xhr gets set to null in
onreadystatechange( "timeout" );,

if ( xhr ) xhr.abort(); never runs and therefor the ajax call never
gets cancelled. Is this a bug or is it how it is meant to work?

It works (closes the connection) if you move xhr.abort(); before
running onreadystatechange.

Line: 3486
if ( s.async ) {
        // don't attach the handler to the request, just poll it instead
        var ival = setInterval(onreadystatechange, 13);
                // Timeout checker
        if ( s.timeout > 0 )
                setTimeout(function(){
                        // Check to see if the request is still happening
                        if ( xhr ) {
                                if( !requestDone )
                                        onreadystatechange( "timeout" );
                                        // Cancel the request

                                if ( xhr )
                                        xhr.abort();
                        }
                }, s.timeout);
}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to