( status, nativeStatusText, responses, headers )
| 655 | |
| 656 | // Callback for when everything is done |
| 657 | function done( status, nativeStatusText, responses, headers ) { |
| 658 | var isSuccess, success, error, response, modified, |
| 659 | statusText = nativeStatusText; |
| 660 | |
| 661 | // Called once |
| 662 | if ( state === 2 ) { |
| 663 | return; |
| 664 | } |
| 665 | |
| 666 | // State is "done" now |
| 667 | state = 2; |
| 668 | |
| 669 | // Clear timeout if it exists |
| 670 | if ( timeoutTimer ) { |
| 671 | clearTimeout( timeoutTimer ); |
| 672 | } |
| 673 | |
| 674 | // Dereference transport for early garbage collection |
| 675 | // (no matter how long the jqXHR object will be used) |
| 676 | transport = undefined; |
| 677 | |
| 678 | // Cache response headers |
| 679 | responseHeadersString = headers || ""; |
| 680 | |
| 681 | // Set readyState |
| 682 | jqXHR.readyState = status > 0 ? 4 : 0; |
| 683 | |
| 684 | // Determine if successful |
| 685 | isSuccess = status >= 200 && status < 300 || status === 304; |
| 686 | |
| 687 | // Get response data |
| 688 | if ( responses ) { |
| 689 | response = ajaxHandleResponses( s, jqXHR, responses ); |
| 690 | } |
| 691 | |
| 692 | // Convert no matter what (that way responseXXX fields are always set) |
| 693 | response = ajaxConvert( s, response, jqXHR, isSuccess ); |
| 694 | |
| 695 | // If successful, handle type chaining |
| 696 | if ( isSuccess ) { |
| 697 | |
| 698 | // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. |
| 699 | if ( s.ifModified ) { |
| 700 | modified = jqXHR.getResponseHeader("Last-Modified"); |
| 701 | if ( modified ) { |
| 702 | jQuery.lastModified[ cacheURL ] = modified; |
| 703 | } |
| 704 | modified = jqXHR.getResponseHeader("etag"); |
| 705 | if ( modified ) { |
| 706 | jQuery.etag[ cacheURL ] = modified; |
| 707 | } |
| 708 | } |
| 709 | |
| 710 | // if no content |
| 711 | if ( status === 204 || s.type === "HEAD" ) { |
| 712 | statusText = "nocontent"; |
| 713 | |
| 714 | // if not modified |
no test coverage detected
searching dependent graphs…