+
+ if ( s.ifModified && statusText === "notmodified" ) {
+
+ success = null;
+ isSuccess = 1;
+
+ } else {
+ // Chain data conversions and determine the final value
+ // (if an exception is thrown in the process, it'll be notified as an error)
+ try {
+
+ var i,
+ current,
+ prev,
+ checker,
+ conv1,
+ conv2,
+ oneConv,
+ convertion,
+ dataTypes = s.dataTypes,
+ converters = s.converters,
+ responses = {
+ "xml": "XML",
+ "text": "Text"
+ };
+
+ for( i = 0 ; i < dataTypes.length ; i++ ) {
+
+ current = dataTypes[ i ];
+
+ if ( responses[ current ] ) {
+ jXHR[ "response" + responses[ current ] ] = response;
+ responses[ current ] = 0;
+ }
+
+ if ( i ) {
+
+ prev = dataTypes[ i - 1 ];
+
+ if ( prev !== "*" && current !== "*" && prev !== current ) {
+
+ oneConv = conv1 =
+ converters[ ( conversion = prev + " " + current ) ] ||
+ converters[ "* " + current ];
+
+ if ( oneConv !== true ) {
+
+ if ( ! oneConv && prev !== "text" && current !== "text" ) {
+ conv1 = converters[ prev + " text" ] || converters[ "* text" ];
+ conv2 = converters[ "text " + current ];
+ }
+
+ if ( oneConv || conv1 && conv2 ) {
+ response = oneConv ? conv1( response ) : conv2( conv1( response ) );
+ } else {
+ throw "no " + conversion;
+ }
+ }
+ }
+ } else if ( s.dataFilter ) {
+
+ response = s.dataFilter( response );
+ dataTypes = s.dataTypes;
+ }
+ }
+
+ // We have a real success
+ success = response;
+ isSuccess = 1;
+
+ } catch(e) {
+
+ statusText = "parsererror";
+ error = "" + e;
+
+ }
+ }
+
+ } else { // if not success, mark it as an error
+
+ error = error || statusText;
+ }
+
+ // Set data for the fake xhr object
+ jXHR.status = status;
+ jXHR.statusText = statusText;
+
+ // Success/Error
+ if ( isSuccess ) {
+ deferred.fire( callbackContext , [ success , statusText , jXHR ] );
+ } else {
+ deferred.fireReject( callbackContext , [ jXHR , statusText , error ] );
+ }
+
+ if ( s.global ) {
+ globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ) ,
+ [ jXHR , s , isSuccess ? success : error ] );
+ }
+
+ // Complete
+ completeDeferred.fire( callbackContext, [ jXHR , statusText ] );
+
+ if ( s.global ) {
+ globalEventContext.trigger( "ajaxComplete" , [ jXHR , s] );
+ // Handle the global AJAX counter
+ if ( ! --jQuery.active ) {
+ jQuery.event.trigger( "ajaxStop" );
+ }
+ }