( status, nativeStatusText, responses, headers )
| 708 | |
| 709 | // Callback for when everything is done |
| 710 | function done( status, nativeStatusText, responses, headers ) { |
| 711 | var isSuccess, success, error, response, modified, |
| 712 | statusText = nativeStatusText; |
| 713 | |
| 714 | // Ignore repeat invocations |
| 715 | if ( completed ) { |
| 716 | return; |
| 717 | } |
| 718 | |
| 719 | completed = true; |
| 720 | |
| 721 | // Clear timeout if it exists |
| 722 | if ( timeoutTimer ) { |
| 723 | window.clearTimeout( timeoutTimer ); |
| 724 | } |
| 725 | |
| 726 | // Dereference transport for early garbage collection |
| 727 | // (no matter how long the jqXHR object will be used) |
| 728 | transport = undefined; |
| 729 | |
| 730 | // Cache response headers |
| 731 | responseHeadersString = headers || ""; |
| 732 | |
| 733 | // Set readyState |
| 734 | jqXHR.readyState = status > 0 ? 4 : 0; |
| 735 | |
| 736 | // Determine if successful |
| 737 | isSuccess = status >= 200 && status < 300 || status === 304; |
| 738 | |
| 739 | // Get response data |
| 740 | if ( responses ) { |
| 741 | response = ajaxHandleResponses( s, jqXHR, responses ); |
| 742 | } |
| 743 | |
| 744 | // Convert no matter what (that way responseXXX fields are always set) |
| 745 | response = ajaxConvert( s, response, jqXHR, isSuccess ); |
| 746 | |
| 747 | // If successful, handle type chaining |
| 748 | if ( isSuccess ) { |
| 749 | |
| 750 | // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. |
| 751 | if ( s.ifModified ) { |
| 752 | modified = jqXHR.getResponseHeader( "Last-Modified" ); |
| 753 | if ( modified ) { |
| 754 | jQuery.lastModified[ cacheURL ] = modified; |
| 755 | } |
| 756 | modified = jqXHR.getResponseHeader( "etag" ); |
| 757 | if ( modified ) { |
| 758 | jQuery.etag[ cacheURL ] = modified; |
| 759 | } |
| 760 | } |
| 761 | |
| 762 | // if no content |
| 763 | if ( status === 204 || s.type === "HEAD" ) { |
| 764 | statusText = "nocontent"; |
| 765 | |
| 766 | // if not modified |
| 767 | } else if ( status === 304 ) { |
no test coverage detected
searching dependent graphs…