MCPcopy Create free account
hub / github.com/JsAaron/jQuery / done

Function done

2.0.3/2.0.3.js:7436–7546  ·  view source on GitHub ↗
( status, nativeStatusText, responses, headers )

Source from the content-addressed store, hash-verified

7434
7435 // Callback for when everything is done
7436 function done( status, nativeStatusText, responses, headers ) {
7437 var isSuccess, success, error, response, modified,
7438 statusText = nativeStatusText;
7439
7440 // Called once
7441 if ( state === 2 ) {
7442 return;
7443 }
7444
7445 // State is "done" now
7446 state = 2;
7447
7448 // Clear timeout if it exists
7449 if ( timeoutTimer ) {
7450 clearTimeout( timeoutTimer );
7451 }
7452
7453 // Dereference transport for early garbage collection
7454 // (no matter how long the jqXHR object will be used)
7455 transport = undefined;
7456
7457 // Cache response headers
7458 responseHeadersString = headers || "";
7459
7460 // Set readyState
7461 jqXHR.readyState = status > 0 ? 4 : 0;
7462
7463 // Determine if successful
7464 isSuccess = status >= 200 && status < 300 || status === 304;
7465
7466 // Get response data
7467 if ( responses ) {
7468 response = ajaxHandleResponses( s, jqXHR, responses );
7469 }
7470
7471 // Convert no matter what (that way responseXXX fields are always set)
7472 response = ajaxConvert( s, response, jqXHR, isSuccess );
7473
7474 // If successful, handle type chaining
7475 if ( isSuccess ) {
7476
7477 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
7478 if ( s.ifModified ) {
7479 modified = jqXHR.getResponseHeader("Last-Modified");
7480 if ( modified ) {
7481 jQuery.lastModified[ cacheURL ] = modified;
7482 }
7483 modified = jqXHR.getResponseHeader("etag");
7484 if ( modified ) {
7485 jQuery.etag[ cacheURL ] = modified;
7486 }
7487 }
7488
7489 // if no content
7490 if ( status === 204 || s.type === "HEAD" ) {
7491 statusText = "nocontent";
7492
7493 // if not modified

Callers 1

2.0.3.jsFile · 0.70

Calls 2

ajaxHandleResponsesFunction · 0.70
ajaxConvertFunction · 0.70

Tested by

no test coverage detected