1 | Index: src/ajax.js |
---|
2 | =================================================================== |
---|
3 | --- src/ajax.js (revision 6489) |
---|
4 | +++ src/ajax.js (working copy) |
---|
5 | @@ -400,6 +400,8 @@ |
---|
6 | "notmodified" : |
---|
7 | "success"; |
---|
8 | |
---|
9 | + if (s.ready) s.ready(xhr, status); |
---|
10 | + |
---|
11 | if ( status === "success" ) { |
---|
12 | // Watch for, and catch, XML document parse errors |
---|
13 | try { |
---|
14 | @@ -462,8 +464,9 @@ |
---|
15 | } |
---|
16 | |
---|
17 | function success(){ |
---|
18 | - // If a local callback was specified, fire it and pass it the data |
---|
19 | - if ( s.success ) { |
---|
20 | + var handler = s[xhr.status] || s.success; |
---|
21 | + // If a local callback was specified, fire it and pass it the data |
---|
22 | + if ( handler ) { |
---|
23 | s.success( data, status ); |
---|
24 | } |
---|
25 | |
---|
26 | @@ -495,9 +498,10 @@ |
---|
27 | }, |
---|
28 | |
---|
29 | handleError: function( s, xhr, status, e ) { |
---|
30 | + var handler = s[xhr.status] || s.error; |
---|
31 | // If a local callback was specified, fire it |
---|
32 | - if ( s.error ) { |
---|
33 | - s.error( xhr, status, e ); |
---|
34 | + if ( handler ) { |
---|
35 | + handler( xhr, status, e ); |
---|
36 | } |
---|
37 | |
---|
38 | // Fire the global callback |
---|