Skip to main content

Bug Tracker

Side navigation

#10533 closed bug (invalid)

Opened October 19, 2011 01:08PM UTC

Closed October 19, 2011 03:40PM UTC

ajaxPrefilter functions not executing in expected order

Reported by: js.luiten@gmail.com 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'

Attachments (0)
Change History (1)

Changed October 19, 2011 03:40PM UTC by timmywil comment:1

component: unfiledajax
priority: undecidedlow
resolution: → invalid
status: newclosed

The more specific filters get precedence.