( status, statusText, responses, headers )
| 7043 | // It is defined here because jslint complains if it is declared |
| 7044 | // at the end of the function (which would be more logical and readable) |
| 7045 | function done( status, statusText, responses, headers ) { |
| 7046 | |
| 7047 | // Called once |
| 7048 | if ( state === 2 ) { |
| 7049 | return; |
| 7050 | } |
| 7051 | |
| 7052 | // State is "done" now |
| 7053 | state = 2; |
| 7054 | |
| 7055 | // Clear timeout if it exists |
| 7056 | if ( timeoutTimer ) { |
| 7057 | clearTimeout( timeoutTimer ); |
| 7058 | } |
| 7059 | |
| 7060 | // Dereference transport for early garbage collection |
| 7061 | // (no matter how long the jqXHR object will be used) |
| 7062 | transport = undefined; |
| 7063 | |
| 7064 | // Cache response headers |
| 7065 | responseHeadersString = headers || ""; |
| 7066 | |
| 7067 | // Set readyState |
| 7068 | jqXHR.readyState = status ? 4 : 0; |
| 7069 | |
| 7070 | var isSuccess, |
| 7071 | success, |
| 7072 | error, |
| 7073 | response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined, |
| 7074 | lastModified, |
| 7075 | etag; |
| 7076 | |
| 7077 | // If successful, handle type chaining |
| 7078 | if ( status >= 200 && status < 300 || status === 304 ) { |
| 7079 | |
| 7080 | // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. |
| 7081 | if ( s.ifModified ) { |
| 7082 | |
| 7083 | if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) { |
| 7084 | jQuery.lastModified[ ifModifiedKey ] = lastModified; |
| 7085 | } |
| 7086 | if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) { |
| 7087 | jQuery.etag[ ifModifiedKey ] = etag; |
| 7088 | } |
| 7089 | } |
| 7090 | |
| 7091 | // If not modified |
| 7092 | if ( status === 304 ) { |
| 7093 | |
| 7094 | statusText = "notmodified"; |
| 7095 | isSuccess = true; |
| 7096 | |
| 7097 | // If we have data |
| 7098 | } else { |
| 7099 | |
| 7100 | try { |
| 7101 | success = ajaxConvert( s, response ); |
| 7102 | statusText = "success"; |
no test coverage detected