: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
finalDataType = finalDataType || firstDataType;
// If we found a dataType
// We add the dataType to the list if needed
// and return the corresponding response
if ( finalDataType !== dataTypes[ 0 ] ) {
dataTypes.unshift( finalDataType );
return responses[ finalDataType ];
/* Chain conversions given the request and the original response
* Also sets the responseXXX fields on the jqXHR instance
function ajaxConvert( s, response, jqXHR, isSuccess ) {
var conv2, current, conv, tmp, prev,
// Work with a copy of dataTypes in case we need to modify it for conversion
dataTypes = s.dataTypes.slice();
// Create converters map with lowercased keys
for ( conv in s.converters ) {
converters[ conv.toLowerCase() ] = s.converters[ conv ];
current = dataTypes.shift();
// Convert to each sequential dataType
if ( s.responseFields[ current ] ) {
jqXHR[ s.responseFields[ current ] ] = response;
// Apply the dataFilter if provided
if ( !prev && isSuccess && s.dataFilter ) {
response = s.dataFilter( response, s.dataType );
current = dataTypes.shift();
// There's only work to do if current dataType is non-auto
// Convert response if prev dataType is non-auto and differs from current
} else if ( prev !== "*" && prev !== current ) {
// Seek a direct converter
conv = converters[ prev + " " + current ] || converters[ "* " + current ];
// If none found, seek a pair
for ( conv2 in converters ) {
// If conv2 outputs current
tmp = conv2.split( " " );
if ( tmp[ 1 ] === current ) {
// If prev can be converted to accepted input
conv = converters[ prev + " " + tmp[ 0 ] ] ||
converters[ "* " + tmp[ 0 ] ];
// Condense equivalence converters
conv = converters[ conv2 ];
// Otherwise, insert the intermediate dataType
} else if ( converters[ conv2 ] !== true ) {
dataTypes.unshift( tmp[ 1 ] );
// Apply converter (if not an equivalence)
// Unless errors are allowed to bubble, catch and return them
if ( conv && s.throws ) {
response = conv( response );
response = conv( response );
error: conv ? e : "No conversion from " + prev + " to " + current
return { state: "success", data: response };
// Counter for holding the number of active queries
// Last-Modified header cache for next request
isLocal: rlocalProtocol.test( location.protocol ),
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
xml: "application/xml, text/xml",
json: "application/json, text/javascript"
// Keys separate source (or catchall "*") and destination types with a single space
// Convert anything to text
// Text to html (true = no transformation)
// Evaluate text as a json expression
"text xml": jQuery.parseXML
// For options that shouldn't be deep extended:
// you can add your own custom options here if
// and when you create one that shouldn't be
// deep extended (see ajaxExtend)
// Creates a full fledged settings object into target
// with both ajaxSettings and settings fields.
// If target is omitted, writes into ajaxSettings.
ajaxSetup: function( target, settings ) {
// Building a settings object
ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
// Extending ajaxSettings
ajaxExtend( jQuery.ajaxSettings, target );
ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
ajaxTransport: addToPrefiltersOrTransports( transports ),
ajax: function( url, options ) {
// If url is an object, simulate pre-1.5 signature
if ( typeof url === "object" ) {
// Force options to be an object
// URL without anti-cache param
// Request state (becomes false upon send and true upon completion)
// To know if global events are to be dispatched
// uncached part of the url
// Create the final options object
s = jQuery.ajaxSetup( {}, options ),
callbackContext = s.context || s,
// Context for global events is callbackContext if it is a DOM node or jQuery collection
globalEventContext = s.context &&
( callbackContext.nodeType || callbackContext.jquery ) ?
jQuery( callbackContext ) :
deferred = jQuery.Deferred(),
completeDeferred = jQuery.Callbacks( "once memory" ),
// Status-dependent callbacks
statusCode = s.statusCode || {},
// Headers (they are sent all at once)
requestHeadersNames = {},
// Builds headers hashtable if needed
getResponseHeader: function( key ) {
if ( !responseHeaders ) {
while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
match = responseHeaders[ key.toLowerCase() + " " ];
return match == null ? null : match.join( ", " );
getAllResponseHeaders: function() {
return completed ? responseHeadersString : null;
setRequestHeader: function( name, value ) {
if ( completed == null ) {
name = requestHeadersNames[ name.toLowerCase() ] =
requestHeadersNames[ name.toLowerCase() ] || name;
requestHeaders[ name ] = value;
// Overrides response content-type header
overrideMimeType: function( type ) {
if ( completed == null ) {
// Status-dependent callbacks
statusCode: function( map ) {
// Execute the appropriate callbacks
jqXHR.always( map[ jqXHR.status ] );
// Lazy-add the new callbacks in a way that preserves old ones
statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
abort: function( statusText ) {
var finalText = statusText || strAbort;
transport.abort( finalText );
deferred.promise( jqXHR );
// Add protocol if not provided (prefilters might expect it)
// Handle falsy url in the settings object (trac-10093: consistency with old signature)
// We also use the url parameter if available
s.url = ( ( url || s.url || location.href ) + "" )
.replace( rprotocol, location.protocol + "//" );
// Alias method option to type as per ticket trac-12004
s.type = options.method || options.type || s.method || s.type;
// Extract dataTypes list
s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
// A cross-domain request is in order when the origin doesn't match the current origin.
if ( s.crossDomain == null ) {
urlAnchor = document.createElement( "a" );
// Support: IE <=8 - 11, Edge 12 - 15
// IE throws exception on accessing the href property if url is malformed,
// e.g. http://example.com:80x/
// Support: IE <=8 - 11 only
// Anchor's host property isn't correctly set when s.url is relative
urlAnchor.href = urlAnchor.href;
s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
urlAnchor.protocol + "//" + urlAnchor.host;
// If there is an error parsing the URL, assume it is crossDomain,
// it can be rejected by the transport if it is invalid
// Convert data if not already a string
if ( s.data && s.processData && typeof s.data !== "string" ) {
s.data = jQuery.param( s.data, s.traditional );
inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
// If request was aborted inside a prefilter, stop there
// We can fire global events as of now if asked to
// Don't fire events if jQuery.event is undefined in an AMD-usage scenario (trac-15118)
fireGlobals = jQuery.event && s.global;
// Watch for a new set of requests
if ( fireGlobals && jQuery.active++ === 0 ) {
jQuery.event.trigger( "ajaxStart" );
s.type = s.type.toUpperCase();
// Determine if request has content
s.hasContent = !rnoContent.test( s.type );
// Save the URL in case we're toying with the If-Modified-Since
// and/or If-None-Match header later on
// Remove hash to simplify url manipulation
cacheURL = s.url.replace( rhash, "" );
// More options handling for requests with no content
// Remember the hash so we can put it back
uncached = s.url.slice( cacheURL.length );
// If data is available and should be processed, append data to url
if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
// trac-9682: remove data so that it's not used in an eventual retry
// Add or update anti-cache param if needed
if ( s.cache === false ) {
cacheURL = cacheURL.replace( rantiCache, "$1" );
uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) +
// Put hash and anti-cache on the URL that will be requested (gh-1732)
s.url = cacheURL + uncached;
// Change '%20' to '+' if this is encoded form body content (gh-2658)
} else if ( s.data && s.processData &&
( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
s.data = s.data.replace( r20, "+" );
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( jQuery.lastModified[ cacheURL ] ) {
jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
if ( jQuery.etag[ cacheURL ] ) {
jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
// Set the correct header, if data is being sent
if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
jqXHR.setRequestHeader( "Content-Type", s.contentType );
// Set the Accepts header for the server, depending on the dataType
s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
s.accepts[ s.dataTypes[ 0 ] ] +
( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
// Check for headers option
jqXHR.setRequestHeader( i, s.headers[ i ] );
// Allow custom headers/mimetypes and early abort
( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
// Abort if not done already and return
// Aborting is no longer a cancellation
// Install callbacks on deferreds
completeDeferred.add( s.complete );
transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
// If no transport, we auto-abort
done( -1, "No Transport" );