( status, nativeStatusText, responses, headers )
| 8669 | |
| 8670 | // Callback for when everything is done |
| 8671 | function done( status, nativeStatusText, responses, headers ) { |
| 8672 | var isSuccess, success, error, response, modified, |
| 8673 | statusText = nativeStatusText; |
| 8674 | |
| 8675 | // Called once |
| 8676 | if ( state === 2 ) { |
| 8677 | return; |
| 8678 | } |
| 8679 | |
| 8680 | // State is "done" now |
| 8681 | state = 2; |
| 8682 | |
| 8683 | // Clear timeout if it exists |
| 8684 | if ( timeoutTimer ) { |
| 8685 | window.clearTimeout( timeoutTimer ); |
| 8686 | } |
| 8687 | |
| 8688 | // Dereference transport for early garbage collection |
| 8689 | // (no matter how long the jqXHR object will be used) |
| 8690 | transport = undefined; |
| 8691 | |
| 8692 | // Cache response headers |
| 8693 | responseHeadersString = headers || ""; |
| 8694 | |
| 8695 | // Set readyState |
| 8696 | jqXHR.readyState = status > 0 ? 4 : 0; |
| 8697 | |
| 8698 | // Determine if successful |
| 8699 | isSuccess = status >= 200 && status < 300 || status === 304; |
| 8700 | |
| 8701 | // Get response data |
| 8702 | if ( responses ) { |
| 8703 | response = ajaxHandleResponses( s, jqXHR, responses ); |
| 8704 | } |
| 8705 | |
| 8706 | // Convert no matter what (that way responseXXX fields are always set) |
| 8707 | response = ajaxConvert( s, response, jqXHR, isSuccess ); |
| 8708 | |
| 8709 | // If successful, handle type chaining |
| 8710 | if ( isSuccess ) { |
| 8711 | |
| 8712 | // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. |
| 8713 | if ( s.ifModified ) { |
| 8714 | modified = jqXHR.getResponseHeader( "Last-Modified" ); |
| 8715 | if ( modified ) { |
| 8716 | jQuery.lastModified[ cacheURL ] = modified; |
| 8717 | } |
| 8718 | modified = jqXHR.getResponseHeader( "etag" ); |
| 8719 | if ( modified ) { |
| 8720 | jQuery.etag[ cacheURL ] = modified; |
| 8721 | } |
| 8722 | } |
| 8723 | |
| 8724 | // if no content |
| 8725 | if ( status === 204 || s.type === "HEAD" ) { |
| 8726 | statusText = "nocontent"; |
| 8727 | |
| 8728 | // if not modified |
no test coverage detected