( status, nativeStatusText, responses, headers )
| 8467 | // It is defined here because jslint complains if it is declared |
| 8468 | // at the end of the function (which would be more logical and readable) |
| 8469 | function done( status, nativeStatusText, responses, headers ) { |
| 8470 | var isSuccess, success, error, response, modified, |
| 8471 | statusText = nativeStatusText; |
| 8472 | |
| 8473 | // Called once |
| 8474 | if ( state === 2 ) { |
| 8475 | return; |
| 8476 | } |
| 8477 | |
| 8478 | // State is "done" now |
| 8479 | state = 2; |
| 8480 | |
| 8481 | // Clear timeout if it exists |
| 8482 | if ( timeoutTimer ) { |
| 8483 | clearTimeout( timeoutTimer ); |
| 8484 | } |
| 8485 | |
| 8486 | // Dereference transport for early garbage collection |
| 8487 | // (no matter how long the jqXHR object will be used) |
| 8488 | transport = undefined; |
| 8489 | |
| 8490 | // Cache response headers |
| 8491 | responseHeadersString = headers || ""; |
| 8492 | |
| 8493 | // Set readyState |
| 8494 | jqXHR.readyState = status > 0 ? 4 : 0; |
| 8495 | |
| 8496 | // Get response data |
| 8497 | if ( responses ) { |
| 8498 | response = ajaxHandleResponses( s, jqXHR, responses ); |
| 8499 | } |
| 8500 | |
| 8501 | // If successful, handle type chaining |
| 8502 | if ( status >= 200 && status < 300 || status === 304 ) { |
| 8503 | |
| 8504 | // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. |
| 8505 | if ( s.ifModified ) { |
| 8506 | |
| 8507 | modified = jqXHR.getResponseHeader("Last-Modified"); |
| 8508 | if ( modified ) { |
| 8509 | jQuery.lastModified[ ifModifiedKey ] = modified; |
| 8510 | } |
| 8511 | modified = jqXHR.getResponseHeader("Etag"); |
| 8512 | if ( modified ) { |
| 8513 | jQuery.etag[ ifModifiedKey ] = modified; |
| 8514 | } |
| 8515 | } |
| 8516 | |
| 8517 | // If not modified |
| 8518 | if ( status === 304 ) { |
| 8519 | |
| 8520 | statusText = "notmodified"; |
| 8521 | isSuccess = true; |
| 8522 | |
| 8523 | // If we have data |
| 8524 | } else { |
| 8525 | |
| 8526 | isSuccess = ajaxConvert( s, response ); |
no test coverage detected
searching dependent graphs…