FWIW, I agree that it should have the same args as the other
callbacks.  Just as all the jQuery ui callbacks get e,ui, it stands to
reason the callbacks should be standardised...

--adam

On Sep 11, 10:13 am, "Brian Relph" <[EMAIL PROTECTED]> wrote:
> I think I agree with you that it does not matter, but not because of your
> reason.  with your logic, there would be no reason to have the xhr object
> available to the error or complete objects either, you can just get it after
> the call.  However, we do need the object within the callbacks, so we can
> easily flex our executions.
>
> I do think it is inconsistent that the success function does not accept the
> xhr object.  I have read through some of the other tickets requesting this
> feature, and they are all marked as 'wontfix' stating that the success
> callback is just a convenience mechanism.  However, I think there is a use
> case that is not currently covered with the $.ajax options.  Here is what I
> want to do:
>
> 1.  Do something before every ajax call -- use beforeSend() callback - this
> has the xhr object
>
> 2.  Do something after every ajax call -- use the complete() callback and
> optionally look at the xhr object
>
> 3.  Do something only for ajax calls that error out, and flex based on
> status code -- use the error callback and look at the xhr object
>
> 4.  Do something only for ajax calls that succeed, and flex based on status
> code -- ??
>
> The only option I see here is to move everything that I want to do from the
> succeed method into the complete method, and everything that I want to do in
> the complete method needs to be duplicated in every ajax call (instead of
> using ajaxSetup() and specifying the complete callback 1 time).
>
> Now, I originally posted my request because I wanted to handle 302s in my
> ajax success callback. I have since released that I have no control over
> 302s, as the browser handles it without returning control to me.  So, for my
> particular situation, I need to find a different solution.  As well, I don't
> have any other use cases for the other status codes, so maybe that is the
> reason for not implementing it.  Maybe nobody wants to flex the success
> callback based on getting a 202 instead of a 200.
>
> So, in summary, I think there is a possible use case that is not covered
> with the current api, but as I realize now, my particular use case would not
> benefit from a change to the callback.  As well, I do not know of another
> 'in-the-real-world' use case, so perhaps there is no reason to make a code
> change for a hypothetical use case.
>
> Thanks for Listening
>
> -Brian
>
>
>
> On Wed, Sep 10, 2008 at 11:53 PM, Michael Geary <[EMAIL PROTECTED]> wrote:
>
> > It doesn't matter, because you can get the xhr object another way:
>
> >    var xhr = $.ajax({
> >        ...
> >        success: function( data, status ) {
> >            console.log( xhr );
> >        },
> >        ...
> >    });
>
> > -Mike
>
> > > Can the ajax success callback also receive the xmlhttprequest
> > > object, just like the error callback?  The situation i am in
> > > is that i need to do something different when i receive a 302
> > > (which is considered success).
>
> --
> Brian

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to