function done( status, nativeStatusText, responses, headers ) {
				var isSuccess, success, error, response, modified,
					statusText = nativeStatusText;

				// Ignore repeat invocations
				if ( completed ) {
					return;
				}

				completed = true;

				// Clear timeout if it exists
				if ( timeoutTimer ) {
					window.clearTimeout( timeoutTimer );
				}

				// Dereference transport for early garbage collection
				// (no matter how long the jqXHR object will be used)
				transport = undefined;

				// Cache response headers
				responseHeadersString = headers || "";

				// Set readyState
				jqXHR.readyState = status > 0 ? 4 : 0;

				// Determine if successful
				isSuccess = status >= 200 && status < 300 || status === 304;

				// Get response data
				if ( responses ) {
					response = ajaxHandleResponses( s, jqXHR, responses );
				}

				// Use a noop converter for missing script
				if ( !isSuccess && jQuery.inArray( "script", s.dataTypes ) > -1 ) {
					s.converters[ "text script" ] = function() {};
				}

				// Convert no matter what (that way responseXXX fields are always set)
				response = ajaxConvert( s, response, jqXHR, isSuccess );

				// If successful, handle type chaining
				if ( isSuccess ) {

					// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
					if ( s.ifModified ) {
						modified = jqXHR.getResponseHeader( "Last-Modified" );
						if ( modified ) {
							jQuery.lastModified[ cacheURL ] = modified;
						}
						modified = jqXHR.getResponseHeader( "etag" );
						if ( modified ) {
							jQuery.etag[ cacheURL ] = modified;
						}
					}

					// if no content
					if ( status === 204 || s.type === "HEAD" ) {
						statusText = "nocontent";

					// if not modified
					} else if ( status === 304 ) {
						statusText = "notmodified";

					// If we have data, let's convert it
					} else {
						statusText = response.state;
						success = response.data;
						error = response.error;
						isSuccess = !error;
					}
				} else {

					// Extract error from statusText and normalize for non-aborts
					error = statusText;
					if ( status || !statusText ) {
						statusText = "error";
						if ( status < 0 ) {
							status = 0;
						}
					}
				}

				// Set data for the fake xhr object
				jqXHR.status = status;
				jqXHR.statusText = ( nativeStatusText || statusText ) + "";

				// Success/Error
				if ( isSuccess ) {
					deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
				} else {
					deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
				}

				// Status-dependent callbacks
				jqXHR.statusCode( statusCode );
				statusCode = undefined;

				if ( fireGlobals ) {
					globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
						[ jqXHR, s, isSuccess ? success : error ] );
				}

				// Complete
				completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );

				if ( fireGlobals ) {
					globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );

					// Handle the global AJAX counter
					if ( !( --jQuery.active ) ) {
						jQuery.event.trigger( "ajaxStop" );
					}
				}
			}
// Callback for when everything is done
Callback for when everything is done
Callback for when everything is done
function done( status, nativeStatusText, responses, headers ) {
				var isSuccess, success, error, response, modified,
					statusText = nativeStatusText;
				if ( completed ) {
					return;
				}
				completed = true;
				if ( timeoutTimer ) {
					window.clearTimeout( timeoutTimer );
				}
				transport = undefined;
				responseHeadersString = headers || "";
				jqXHR.readyState = status > 0 ? 4 : 0;
				isSuccess = status >= 200 && status < 300 || status === 304;
				if ( responses ) {
					response = ajaxHandleResponses( s, jqXHR, responses );
				}
				if ( !isSuccess && jQuery.inArray( "script", s.dataTypes ) > -1 ) {
					s.converters[ "text script" ] = function() {};
				}
				response = ajaxConvert( s, response, jqXHR, isSuccess );
				if ( isSuccess ) {
					if ( s.ifModified ) {
						modified = jqXHR.getResponseHeader( "Last-Modified" );
						if ( modified ) {
							jQuery.lastModified[ cacheURL ] = modified;
						}
						modified = jqXHR.getResponseHeader( "etag" );
						if ( modified ) {
							jQuery.etag[ cacheURL ] = modified;
						}
					}
					if ( status === 204 || s.type === "HEAD" ) {
						statusText = "nocontent";
					} else if ( status === 304 ) {
						statusText = "notmodified";
					} else {
						statusText = response.state;
						success = response.data;
						error = response.error;
						isSuccess = !error;
					}
				} else {
					error = statusText;
					if ( status || !statusText ) {
						statusText = "error";
						if ( status < 0 ) {
							status = 0;
						}
					}
				}
				jqXHR.status = status;
				jqXHR.statusText = ( nativeStatusText || statusText ) + "";
				if ( isSuccess ) {
					deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
				} else {
					deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
				}
				jqXHR.statusCode( statusCode );
				statusCode = undefined;
				if ( fireGlobals ) {
					globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
						[ jqXHR, s, isSuccess ? success : error ] );
				}
				completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
				if ( fireGlobals ) {
					globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
					if ( !( --jQuery.active ) ) {
						jQuery.event.trigger( "ajaxStop" );
					}
				}
			}
function done ( status , nativeStatusText , responses , headers ) { var isSuccess , success , error , response , modified , statusText = nativeStatusText ; if ( completed ) { return ; } completed = true ; if ( timeoutTimer ) { window . clearTimeout ( timeoutTimer ) ; } transport = undefined ; responseHeadersString = headers || "" ; jqXHR . readyState = status > 0 ? 4 : 0 ; isSuccess = status >= 200 && status < 300 || status === 304 ; if ( responses ) { response = ajaxHandleResponses ( s , jqXHR , responses ) ; } if ( ! isSuccess && jQuery . inArray ( "script" , s . dataTypes ) > - 1 ) { s . converters [ "text script" ] = function ( ) { } ; } response = ajaxConvert ( s , response , jqXHR , isSuccess ) ; if ( isSuccess ) { if ( s . ifModified ) { modified = jqXHR . getResponseHeader ( "Last-Modified" ) ; if ( modified ) { jQuery . lastModified [ cacheURL ] = modified ; } modified = jqXHR . getResponseHeader ( "etag" ) ; if ( modified ) { jQuery . etag [ cacheURL ] = modified ; } } if ( status === 204 || s . type === "HEAD" ) { statusText = "nocontent" ; } else if ( status === 304 ) { statusText = "notmodified" ; } else { statusText = response . state ; success = response . data ; error = response . error ; isSuccess = ! error ; } } else { error = statusText ; if ( status || ! statusText ) { statusText = "error" ; if ( status < 0 ) { status = 0 ; } } } jqXHR . status = status ; jqXHR . statusText = ( nativeStatusText || statusText ) + "" ; if ( isSuccess ) { deferred . resolveWith ( callbackContext , [ success , statusText , jqXHR ] ) ; } else { deferred . rejectWith ( callbackContext , [ jqXHR , statusText , error ] ) ; } jqXHR . statusCode ( statusCode ) ; statusCode = undefined ; if ( fireGlobals ) { globalEventContext . trigger ( isSuccess ? "ajaxSuccess" : "ajaxError" , [ jqXHR , s , isSuccess ? success : error ] ) ; } completeDeferred . fireWith ( callbackContext , [ jqXHR , statusText ] ) ; if ( fireGlobals ) { globalEventContext . trigger ( "ajaxComplete" , [ jqXHR , s ] ) ; if ( ! ( -- jQuery . active ) ) { jQuery . event . trigger ( "ajaxStop" ) ; } } }
Callback for when everything is done
Callback for when everything is done
// Ignore repeat invocations // Clear timeout if it exists // Dereference transport for early garbage collection // (no matter how long the jqXHR object will be used) // Cache response headers // Set readyState // Determine if successful // Get response data // Use a noop converter for missing script // Convert no matter what (that way responseXXX fields are always set) // If successful, handle type chaining // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. // if no content // if not modified // If we have data, let's convert it // Extract error from statusText and normalize for non-aborts // Set data for the fake xhr object // Success/Error // Status-dependent callbacks // Complete // Handle the global AJAX counter