An ajax call can error out if:

- it times out (per the timeout option)
- the server response status indicates an error (ie: 401, 404)
- an exception is thrown during the send operation
- an exception is thrown when processing the response

The last item above is especially interesting because it includes any
success handler you have defined (locally or globally).

If you define an "error" function, locally or via ajaxSettings, that
function is passed three args: the XHR, a status string (which will
always be "error") and an exception object if applicable.  If you use
the ajaxError callback mechanism, via $().ajaxError(fn), there will be
four args passed to your fn:  the event name (which will always be
"ajaxError"), the XHR, the ajax options used to submit the request,
and an exception object if applicable.

When in doubt, use firebug to put a breakpoint on your handler fn and
then "watch" the arguments variable.

Hope this helps.

Mike



On 8/2/07, Joe <[EMAIL PROTECTED]> wrote:
>
> My .ajax call is erroring out and I can't figure out why.   Was
> working fine, and all the sudden quit.
>
> I am looking for an example of the .ajax error function.  Documentaion
> says: error (Function) - A function to be called if the request fails.
> The function gets passed three arguments: The XMLHttpRequest object, a
> string describing the type of error that occurred and an optional
> exception object, if one occurred.
>
> I tried:  error: function(request, settings, expobj).  Is that
> correct?
> expobj=undefined when I display it.
> Where can I find a list of errors the .ajax call can return?
>
>

Reply via email to