jQuery.ajaxPrefilter()The jQuery.ajaxPrefilter() method in jQuery is used to customize Ajax options before each request is sent and before they are processed by $.ajax().
jQuery.ajaxPrefilter() syntaxjQuery.ajaxPrefilter( [dataTypes ], handler )
dataTypes is an optional string containing one or more space-separated dataTypes.
handler to set default values
jQuery.ajaxPrefilter() exampleautomatically abort a request to the same URL if the custom abortOnRetry option is set to true
var currentRequests = {};
$.ajaxPrefilter(function( options, originalOptions, jqXHR ) {
if ( options.abortOnRetry ) {
if ( currentRequests[ options.url ] ) {
currentRequests[ options.url ].abort();
}
currentRequests[ options.url ] = jqXHR;
}
});
