You can use a "complete" handler instead of a "success" handler:

$.ajax({
    url: 'myPage.jsp',
    complete: function(xhr, status) {
        // the status arg is either "success", "error" or "timeout"
        // status codes can be retrieved from the xhr
        alert(xhr.status);
    }
};

Mike

On 8/28/07, oravecz <[EMAIL PROTECTED]> wrote:
>
> Is there a more "raw" form of .ajax (or get, .post) that will expose
> the XHR method to the success (or error) handler?
>
> I am attempting to convert an application to jQuery that has a
> proprietary server module that uses a wide range of HTTP status codes
> for certain nuances on the client.
>
> I notice that the XHR is returned when an ajax method is invoked:
>
> var xhr = $.get(uri, options.parameters, options.onSuccess, 'xml');
>
> I suppose I could create a new class that encapsulates the ajax call
> and makes the XHR method available as a private variable. If I provide
> my own onSuccess handler proxy, I could gain access to the XHR
> variable and pass it along. I am hoping that jQuery or a plugin may
> have already taken care of this.
>
>

Reply via email to