jquery.mockjax.js
function createJsonpCallback( requestSettings, mockHandler, origSettings ) {
		var callbackContext = origSettings && origSettings.context || requestSettings;
		var jsonp = requestSettings.jsonpCallback || ("jsonp" + jsc++);

		// Replace the =? sequence both in the query string and the data
		if ( requestSettings.data ) {
			requestSettings.data = (requestSettings.data + "").replace(CALLBACK_REGEX, "=" + jsonp + "$1");
		}

		requestSettings.url = requestSettings.url.replace(CALLBACK_REGEX, "=" + jsonp + "$1");


		// Handle JSONP-style loading
		window[ jsonp ] = window[ jsonp ] || function( tmp ) {
			data = tmp;
			jsonpSuccess( requestSettings, callbackContext, mockHandler );
			jsonpComplete( requestSettings, callbackContext, mockHandler );
			// Garbage collect
			window[ jsonp ] = undefined;

			try {
				delete window[ jsonp ];
			} catch(e) {}

			if ( head ) {
				head.removeChild( script );
			}
		};
	}
function createJsonpCallback( requestSettings, mockHandler, origSettings ) {
		var callbackContext = origSettings && origSettings.context || requestSettings;
		var jsonp = requestSettings.jsonpCallback || ("jsonp" + jsc++);

		// Replace the =? sequence both in the query string and the data
		if ( requestSettings.data ) {
			requestSettings.data = (requestSettings.data + "").replace(CALLBACK_REGEX, "=" + jsonp + "$1");
		}

		requestSettings.url = requestSettings.url.replace(CALLBACK_REGEX, "=" + jsonp + "$1");


		// Handle JSONP-style loading
		window[ jsonp ] = window[ jsonp ] || function( tmp ) {
			data = tmp;
			jsonpSuccess( requestSettings, callbackContext, mockHandler );
			jsonpComplete( requestSettings, callbackContext, mockHandler );
			// Garbage collect
			window[ jsonp ] = undefined;

			try {
				delete window[ jsonp ];
			} catch(e) {}

			if ( head ) {
				head.removeChild( script );
			}
		};
	}
function createJsonpCallback ( requestSettings , mockHandler , origSettings ) { var callbackContext = origSettings && origSettings . context || requestSettings ; var jsonp = requestSettings . jsonpCallback || ( "jsonp" + jsc ++ ) ; // Replace the =? sequence both in the query string and the data if ( requestSettings . data ) { requestSettings . data = ( requestSettings . data + "" ) . replace ( CALLBACK_REGEX , "=" + jsonp + "$1" ) ; } requestSettings . url = requestSettings . url . replace ( CALLBACK_REGEX , "=" + jsonp + "$1" ) ; // Handle JSONP-style loading window [ jsonp ] = window [ jsonp ] || function ( tmp ) { data = tmp ; jsonpSuccess ( requestSettings , callbackContext , mockHandler ) ; jsonpComplete ( requestSettings , callbackContext , mockHandler ) ; // Garbage collect window [ jsonp ] = undefined ; try { delete window [ jsonp ] ; } catch ( e ) { } if ( head ) { head . removeChild ( script ) ; } } ; }
Create the required JSONP callback function for the request
Create the required JSONP callback function for the request