Modify ↓
Ticket #10533 (closed bug: invalid)
ajaxPrefilter functions not executing in expected order
| Reported by: | js.luiten@… | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | None |
| Component: | ajax | Version: | 1.7b2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
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
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

The more specific filters get precedence.