Cheers for the reply :)

I'm pretty sure it was _a_ John that said it then haha. Seem to
remembering it being a post about the 1.0 release so it was a few
months ago.

On Jul 31, 5:41 pm, "Mike Alsup" <[EMAIL PROTECTED]> wrote:
> I'm sure you didn't read that from John!  :-)
>
> error functions fire when there is an error.  success functions fire
> when there is no error.  In your case they both fire because you're
> invoking the error function directly.  You need to pass a function
> reference like you did for the success handler.
>
> function getXML () {
>    $.ajax({
>        dataType: "xml",
>        error:   function() {errorMessage("The data could not be loaded.") },
>        success: function (msg){parseXML(msg);},
>        timeout: 10000,
>        url: xmlUrl
>    });
>
> };
>
> On 7/31/07, devioustree <[EMAIL PROTECTED]> wrote:
>
>
>
> > I was wondering why this code was giving me the error _and_ parsing my
> > XML:
>
> >         function getXML () {
> >                 $.ajax({
> >                         dataType: "xml",
> >                         error: errorMessage("The data could not be 
> > loaded."),
> >                         success: function (msg){parseXML(msg);},
> >                         timeout: 10000,
> >                         url: xmlUrl
> >                 });
> >         };
>
> > when I read (from John himself I believe) that both error and success
> > are fired if the request fails or is successful. Can somebody explain
> > the logic here? Have I just misunderstood something?
>
> > Also, is it possible to have the error message show only when the
> > request fails and success show only when the request works?
>
> > Cheers.

Reply via email to