MCPcopy Create free account
hub / github.com/components/jquery / done

Function done

jquery.js:8629–8746  ·  view source on GitHub ↗
( status, nativeStatusText, responses, headers )

Source from the content-addressed store, hash-verified

8627
8628 // Callback for when everything is done
8629 function done( status, nativeStatusText, responses, headers ) {
8630 var isSuccess, success, error, response, modified,
8631 statusText = nativeStatusText;
8632
8633 // Ignore repeat invocations
8634 if ( completed ) {
8635 return;
8636 }
8637
8638 completed = true;
8639
8640 // Clear timeout if it exists
8641 if ( timeoutTimer ) {
8642 window.clearTimeout( timeoutTimer );
8643 }
8644
8645 // Dereference transport for early garbage collection
8646 // (no matter how long the jqXHR object will be used)
8647 transport = undefined;
8648
8649 // Cache response headers
8650 responseHeadersString = headers || "";
8651
8652 // Set readyState
8653 jqXHR.readyState = status > 0 ? 4 : 0;
8654
8655 // Determine if successful
8656 isSuccess = status >= 200 && status < 300 || status === 304;
8657
8658 // Get response data
8659 if ( responses ) {
8660 response = ajaxHandleResponses( s, jqXHR, responses );
8661 }
8662
8663 // Use a noop converter for missing script but not if jsonp
8664 if ( !isSuccess &&
8665 jQuery.inArray( "script", s.dataTypes ) > -1 &&
8666 jQuery.inArray( "json", s.dataTypes ) < 0 ) {
8667 s.converters[ "text script" ] = function() {};
8668 }
8669
8670 // Convert no matter what (that way responseXXX fields are always set)
8671 response = ajaxConvert( s, response, jqXHR, isSuccess );
8672
8673 // If successful, handle type chaining
8674 if ( isSuccess ) {
8675
8676 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
8677 if ( s.ifModified ) {
8678 modified = jqXHR.getResponseHeader( "Last-Modified" );
8679 if ( modified ) {
8680 jQuery.lastModified[ cacheURL ] = modified;
8681 }
8682 modified = jqXHR.getResponseHeader( "etag" );
8683 if ( modified ) {
8684 jQuery.etag[ cacheURL ] = modified;
8685 }
8686 }

Callers 1

jquery.jsFile · 0.85

Calls 2

ajaxHandleResponsesFunction · 0.85
ajaxConvertFunction · 0.85

Tested by

no test coverage detected