The XHR object and the error are passed as arguments to the ajaxError
callback:

$.ajaxError(function(event, XHRObject, options, errorThrown){
    console.log( XHRObject.responseText, errorThrown );
});

see http://docs.jquery.com/Ajax/ajaxError#callback

On Nov 24, 4:09 am, Adwin  Wijaya <[EMAIL PROTECTED]> wrote:
> how about using ajaxError events ? but I dont know how to capture the
> response text if 404 / 500 errors occured.
> can i use that instead of $.ajax ...  ?
>
> thanks !
>
> On Nov 24, 12:18 pm, "Jeffrey Kretz" <[EMAIL PROTECTED]> wrote:
>
> > The best way would be to use the $.ajax call directly (both the post and the
> > get function call $.ajax internally).
>
> > $.ajax({
> >    type:'GET',
> >    url:'somepath.php',
> >    dataType:'json',
> >    success:do_something,
> >    error:do_something_else
>
> > });
>
> > function do_something(results) {
> >   ///
>
> > }
>
> > function do_something_else() {
> >   ///
>
> > }
>
> > JK
>
> > -----Original Message-----
> > From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
>
> > Behalf Of Adwin Wijaya
> > Sent: Sunday, November 23, 2008 8:58 PM
> > To: jQuery (English)
> > Subject: [jQuery] how to capture error 500/404 ?
>
> > Hi,
>
> > how to capture error that produced by server (err 505 or 404) inside
> > $.post() and $.get() ?
>
> > thanks !!!

Reply via email to