Ajax error callback in 1.4

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Ajax error callback in 1.4

Donald @ White Whale
I read the 1.4 release notes but am a little confused about the
following. I'd guess it's related to the ability to specify ajax
contexts (really neat!), but it breaks some existing code in a web
application I develop.

1.2.6/1.3.2 success and error callbacks:
value of this: the options object, so that
this.url: the URL of the request

This is still the case for the 1.4 success callback, but the error
callback
value of this: DOMWindow

For context, our app uses $.ajaxSetup() to set the success/error
callbacks to log Ajax requests along the lines of:
error:function() {
  messages.html("Sorry, pal, there was an error loading "+this.url);
}

How can I get the requested URL in 1.4?

Here's a test case:
http://www.babywhale.net/jquery/ajax.php

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


Reply | Threaded
Open this post in threaded view
|

Re: Ajax error callback in 1.4

John Resig
Administrator
Good catch. Filed and fixed:
http://dev.jquery.com/ticket/5838

--John



On Fri, Jan 15, 2010 at 7:47 PM, Donald @ White Whale
<[hidden email]> wrote:

> I read the 1.4 release notes but am a little confused about the
> following. I'd guess it's related to the ability to specify ajax
> contexts (really neat!), but it breaks some existing code in a web
> application I develop.
>
> 1.2.6/1.3.2 success and error callbacks:
> value of this: the options object, so that
> this.url: the URL of the request
>
> This is still the case for the 1.4 success callback, but the error
> callback
> value of this: DOMWindow
>
> For context, our app uses $.ajaxSetup() to set the success/error
> callbacks to log Ajax requests along the lines of:
> error:function() {
>  messages.html("Sorry, pal, there was an error loading "+this.url);
> }
>
> How can I get the requested URL in 1.4?
>
> Here's a test case:
> http://www.babywhale.net/jquery/ajax.php
>
> --
> You received this message because you are subscribed to the Google Groups "jQuery Development" group.
> To post to this group, send email to [hidden email].
> To unsubscribe from this group, send email to [hidden email].
> For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.
>
>
>
>

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


Reply | Threaded
Open this post in threaded view
|

Re: Ajax error callback in 1.4

malsup
> Good catch. Filed and fixed:http://dev.jquery.com/ticket/5838

Also note that the call to jQuery.handleError in the
onreadystatechange function does not get passed exception string that
may have been thrown from jQuery.httpData (such as "Invalid JSON").

http://dev.jquery.com/ticket/5839

http://jquery.malsup.com/test/ajax.html

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


Reply | Threaded
Open this post in threaded view
|

Re: Re: Ajax error callback in 1.4

jaubourg
FYI, in the ajax rewrite, you get a generic "parsererror".

2010/1/16 Mike Alsup <[hidden email]>
> Good catch. Filed and fixed:http://dev.jquery.com/ticket/5838

Also note that the call to jQuery.handleError in the
onreadystatechange function does not get passed exception string that
may have been thrown from jQuery.httpData (such as "Invalid JSON").

http://dev.jquery.com/ticket/5839

http://jquery.malsup.com/test/ajax.html

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





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