( status, nativeStatusText, responses, headers )
| 7989 | |
| 7990 | // Callback for when everything is done |
| 7991 | function done( status, nativeStatusText, responses, headers ) { |
| 7992 | var isSuccess, success, error, response, modified, |
| 7993 | statusText = nativeStatusText; |
| 7994 | |
| 7995 | // Called once |
| 7996 | if ( state === 2 ) { |
| 7997 | return; |
| 7998 | } |
| 7999 | |
| 8000 | // State is "done" now |
| 8001 | state = 2; |
| 8002 | |
| 8003 | // Clear timeout if it exists |
| 8004 | if ( timeoutTimer ) { |
| 8005 | clearTimeout( timeoutTimer ); |
| 8006 | } |
| 8007 | |
| 8008 | // Dereference transport for early garbage collection |
| 8009 | // (no matter how long the jqXHR object will be used) |
| 8010 | transport = undefined; |
| 8011 | |
| 8012 | // Cache response headers |
| 8013 | responseHeadersString = headers || ""; |
| 8014 | |
| 8015 | // Set readyState |
| 8016 | jqXHR.readyState = status > 0 ? 4 : 0; |
| 8017 | |
| 8018 | // Get response data |
| 8019 | if ( responses ) { |
| 8020 | response = ajaxHandleResponses( s, jqXHR, responses ); |
| 8021 | } |
| 8022 | |
| 8023 | // If successful, handle type chaining |
| 8024 | if ( status >= 200 && status < 300 || status === 304 ) { |
| 8025 | |
| 8026 | // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. |
| 8027 | if ( s.ifModified ) { |
| 8028 | modified = jqXHR.getResponseHeader("Last-Modified"); |
| 8029 | if ( modified ) { |
| 8030 | jQuery.lastModified[ cacheURL ] = modified; |
| 8031 | } |
| 8032 | modified = jqXHR.getResponseHeader("etag"); |
| 8033 | if ( modified ) { |
| 8034 | jQuery.etag[ cacheURL ] = modified; |
| 8035 | } |
| 8036 | } |
| 8037 | |
| 8038 | // if no content |
| 8039 | if ( status === 204 ) { |
| 8040 | isSuccess = true; |
| 8041 | statusText = "nocontent"; |
| 8042 | |
| 8043 | // if not modified |
| 8044 | } else if ( status === 304 ) { |
| 8045 | isSuccess = true; |
| 8046 | statusText = "notmodified"; |
| 8047 | |
| 8048 | // If we have data, let's convert it |
no test coverage detected
searching dependent graphs…