: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
// If request was aborted inside ajaxSend, stop there
if ( s.async && s.timeout > 0 ) {
timeoutTimer = window.setTimeout( function() {
jqXHR.abort( "timeout" );
transport.send( requestHeaders, done );
// Rethrow post-completion exceptions
// Propagate others as results
// Callback for when everything is done
function done( status, nativeStatusText, responses, headers ) {
var isSuccess, success, error, response, modified,
statusText = nativeStatusText;
// Ignore repeat invocations
// Clear timeout if it exists
window.clearTimeout( timeoutTimer );
// Dereference transport for early garbage collection
// (no matter how long the jqXHR object will be used)
// Cache response headers
responseHeadersString = headers || "";
jqXHR.readyState = status > 0 ? 4 : 0;
// Determine if successful
isSuccess = status >= 200 && status < 300 || status === 304;
response = ajaxHandleResponses( s, jqXHR, responses );
// Use a noop converter for missing script but not if jsonp
jQuery.inArray( "script", s.dataTypes ) > -1 &&
jQuery.inArray( "json", s.dataTypes ) < 0 ) {
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
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
modified = jqXHR.getResponseHeader( "Last-Modified" );
jQuery.lastModified[ cacheURL ] = modified;
modified = jqXHR.getResponseHeader( "etag" );
jQuery.etag[ cacheURL ] = modified;
if ( status === 204 || s.type === "HEAD" ) {
statusText = "nocontent";
} else if ( status === 304 ) {
statusText = "notmodified";
// If we have data, let's convert it
statusText = response.state;
// Extract error from statusText and normalize for non-aborts
if ( status || !statusText ) {
// Set data for the fake xhr object
jqXHR.statusText = ( nativeStatusText || statusText ) + "";
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
// Status-dependent callbacks
jqXHR.statusCode( statusCode );
globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
[ jqXHR, s, isSuccess ? success : error ] );
completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
// Handle the global AJAX counter
if ( !( --jQuery.active ) ) {
jQuery.event.trigger( "ajaxStop" );
getJSON: function( url, data, callback ) {
return jQuery.get( url, data, callback, "json" );
getScript: function( url, callback ) {
return jQuery.get( url, undefined, callback, "script" );
jQuery.each( [ "get", "post" ], function( _i, method ) {
jQuery[ method ] = function( url, data, callback, type ) {
// Shift arguments if data argument was omitted
if ( isFunction( data ) ) {
// The url can be an options object (which then must have .url)
return jQuery.ajax( jQuery.extend( {
}, jQuery.isPlainObject( url ) && url ) );
jQuery.ajaxPrefilter( function( s ) {
if ( i.toLowerCase() === "content-type" ) {
s.contentType = s.headers[ i ] || "";
jQuery._evalUrl = function( url, options, doc ) {
// Make this explicit, since user can override this through ajaxSetup (trac-11264)
// Only evaluate the response if it is successful (gh-4126)
// dataFilter is not invoked for failure responses, so using it instead
// of the default converter is kludgy but it works.
"text script": function() {}
dataFilter: function( response ) {
jQuery.globalEval( response, options, doc );
wrapAll: function( html ) {
if ( isFunction( html ) ) {
html = html.call( this[ 0 ] );
// The elements to wrap the target around
wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
if ( this[ 0 ].parentNode ) {
wrap.insertBefore( this[ 0 ] );
while ( elem.firstElementChild ) {
elem = elem.firstElementChild;
wrapInner: function( html ) {
if ( isFunction( html ) ) {
return this.each( function( i ) {
jQuery( this ).wrapInner( html.call( this, i ) );
return this.each( function() {
var self = jQuery( this ),
contents = self.contents();
contents.wrapAll( html );
var htmlIsFunction = isFunction( html );
return this.each( function( i ) {
jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
unwrap: function( selector ) {
this.parent( selector ).not( "body" ).each( function() {
jQuery( this ).replaceWith( this.childNodes );
jQuery.expr.pseudos.hidden = function( elem ) {
return !jQuery.expr.pseudos.visible( elem );
jQuery.expr.pseudos.visible = function( elem ) {
return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
jQuery.ajaxSettings.xhr = function() {
return new window.XMLHttpRequest();
// File protocol always yields status code 0, assume 200
// trac-1450: sometimes IE returns 1223 when it should be 204
xhrSupported = jQuery.ajaxSettings.xhr();
support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
support.ajax = xhrSupported = !!xhrSupported;
jQuery.ajaxTransport( function( options ) {
var callback, errorCallback;
// Cross domain only allowed if supported through XMLHttpRequest
if ( support.cors || xhrSupported && !options.crossDomain ) {
send: function( headers, complete ) {
// Apply custom fields if provided
if ( options.xhrFields ) {
for ( i in options.xhrFields ) {
xhr[ i ] = options.xhrFields[ i ];
// Override mime type if needed
if ( options.mimeType && xhr.overrideMimeType ) {
xhr.overrideMimeType( options.mimeType );
// X-Requested-With header
// For cross-domain requests, seeing as conditions for a preflight are
// akin to a jigsaw puzzle, we simply never set it to be sure.
// (it can always be set on a per-request basis or even using ajaxSetup)
// For same-domain requests, won't change header if already provided.
if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
headers[ "X-Requested-With" ] = "XMLHttpRequest";
xhr.setRequestHeader( i, headers[ i ] );
callback = function( type ) {
callback = errorCallback = xhr.onload =
xhr.onerror = xhr.onabort = xhr.ontimeout =
xhr.onreadystatechange = null;
if ( type === "abort" ) {
} else if ( type === "error" ) {
// On a manual native abort, IE9 throws
// errors on any property access that is not readyState
if ( typeof xhr.status !== "number" ) {
// File: protocol always yields status 0; see trac-8605, trac-14207
xhrSuccessStatus[ xhr.status ] || xhr.status,
// IE9 has no XHR2 but throws on binary (trac-11426)
// For XHR2 non-text, let the caller handle it (gh-2498)
( xhr.responseType || "text" ) !== "text" ||
typeof xhr.responseText !== "string" ?
{ binary: xhr.response } :
{ text: xhr.responseText },
xhr.getAllResponseHeaders()
errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
// Use onreadystatechange to replace onabort
// to handle uncaught aborts
if ( xhr.onabort !== undefined ) {
xhr.onabort = errorCallback;
xhr.onreadystatechange = function() {
// Check readyState before timeout as it changes
if ( xhr.readyState === 4 ) {
// Allow onerror to be called first,
// but that will not handle a native abort
// Also, save errorCallback to a variable
// as xhr.onerror cannot be accessed
window.setTimeout( function() {
// Create the abort callback
callback = callback( "abort" );
// Do send the request (this may raise an exception)
xhr.send( options.hasContent && options.data || null );
// trac-14683: Only rethrow if this hasn't been notified as an error yet
// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
jQuery.ajaxPrefilter( function( s ) {
s.contents.script = false;
// Install script dataType
script: "text/javascript, application/javascript, " +
"application/ecmascript, application/x-ecmascript"
script: /\b(?:java|ecma)script\b/
"text script": function( text ) {
jQuery.globalEval( text );
// Handle cache's special case and crossDomain
jQuery.ajaxPrefilter( "script", function( s ) {
if ( s.cache === undefined ) {
// Bind script tag hack transport
jQuery.ajaxTransport( "script", function( s ) {
// This transport only deals with cross domain or forced-by-attrs requests
if ( s.crossDomain || s.scriptAttrs ) {