Bug Tracker

Opened 11 years ago

Closed 11 years ago

#10533 closed bug (invalid)

ajaxPrefilter functions not executing in expected order

Reported by: [email protected] Owned by:
Priority: low Milestone: None
Component: ajax Version: 1.7b2
Keywords: Cc:
Blocked by: Blocking:

Description

Suppose you want to set a prefilter for ajax calls of all dataTypes, and after that only for some datatypes.

I expect the prefilters to run in the order I supply them, but prefilters with the dataTypes argument set run first.

jQuery.ajaxPrefilter(function(){
  console.log(1);
});

jQuery.ajaxPrefilter('text', function(){ // or any combination of dataTypes
  console.log(2)
});

// log:
// 2
// 1

Setting '*' as the dataType on the first function does not solve the problem. Instead you must manually enter all possible dataTypes: 'text html json xml script jsonp'

Change History (1)

comment:1 Changed 11 years ago by Timmy Willison

Component: unfiledajax
Priority: undecidedlow
Resolution: invalid
Status: newclosed

The more specific filters get precedence.

Note: See TracTickets for help on using tickets.