Re: [jQuery] $.ajax API change 1.0.2?

2006-10-13 Thread Steven Wittens

> ou! the complete handler... perhaps it just needs a little more
> documentation? Or did I miss it?

It's documented on $.ajax...

(Function) error - A function to be called if the request fails. The  
function gets passed two arguments: The XMLHttpRequest object and a  
string describing the type of error that occurred.

(Function) success - A function to be called if the request succeeds.  
The function gets passed one argument: The data returned from the  
server, formatted according to the 'dataType' parameter.

(Function) complete - A function to be called when the request  
finishes. The function gets passed two arguments: The XMLHttpRequest  
object and a string describing the type the success of the request.


Steven Wittens




___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] $.ajax API change 1.0.2?

2006-10-13 Thread Ⓙⓐⓚⓔ
ou! the complete handler... perhaps it just needs a little more
documentation? Or did I miss it?

On 10/13/06, Steven Wittens <[EMAIL PROTECTED]> wrote:
>
> > Yup! I noticed that too. It broke a few pages, and scared me into
> > DEBUGGING mode, I always liked getting back the whole httpreq.
>
> Well you can still use the "complete" handler to get the
> XMLHttpRequest back, but that handler fires regardless of success or
> failure. You'd have to check the status argument for that.
>
> Steven Wittens
>
>
>
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>


-- 
Ⓙⓐⓚⓔ - יעקב   ʝǡǩȩ   ᎫᎪᏦᎬ
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] $.ajax API change 1.0.2?

2006-10-13 Thread John Resig
Steven -

This is all an excellent point - and something that I regret doing.

I've posted your notes on the jQuery blog, explaining the situation to everyone.
http://jquery.com/blog/2006/10/13/minor-api-change-in-102/

Thanks again.

--John

On 10/13/06, Steven Wittens <[EMAIL PROTECTED]> wrote:
> It seems that the 'success' callback of $.ajax was changed to accept
> as its first argument the actual parsed data rather than the xmlHttp
> object, in 1.0.2? This behaviour broke several Drupal features when I
> upgraded it to jQuery 1.0.2...
>
> We should really avoid such API changes in the future, or bump up the
> middle version digit instead. In jQuery, the line between what is a
> private function and what is an API call is indeed blurred (so
> guaranteeing compatibility across versions for everything is near-
> impossible), but it would be nice if this stuff was at least
> documented. I looked around and can't seem to find any mention of
> this on the 1.0.2 release notes or on this mailing list.
>
> In Drupal, we document all API changes on a page with before/after
> examples. If you build such a page when you commit changes to the
> repository, it's not that much work.
>
> Here's a snippet to document this change (if I got it right):
>
> == $.ajax callback changed ==
> In jQuery 1.0.2, the first argument to the 'succes' callback has been
> changed to return the actual data rather than the XMLHttpRequest
> object. Use the 'dataType' argument to $.ajax to control how the data
> is returned. Note that jQuery can now parse XML, JSON and JavaScript
> for you this way.
>
> // jQuery 1.0.1
> $.ajax( {
>success: function (xmlhttp) {
>  // do stuff with xmlhttp.responseText
>}
> );
> // jQuery 1.0.2
> $.ajax( {
>success: function (data) {
>  // do stuff with data
>}
> );
>
>
> Steven Wittens
>
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>


-- 
John Resig
http://ejohn.org/
[EMAIL PROTECTED]

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] $.ajax API change 1.0.2?

2006-10-13 Thread Steven Wittens

> Yup! I noticed that too. It broke a few pages, and scared me into
> DEBUGGING mode, I always liked getting back the whole httpreq.

Well you can still use the "complete" handler to get the  
XMLHttpRequest back, but that handler fires regardless of success or  
failure. You'd have to check the status argument for that.

Steven Wittens



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] $.ajax API change 1.0.2?

2006-10-13 Thread Ⓙⓐⓚⓔ
Yup! I noticed that too. It broke a few pages, and scared me into
DEBUGGING mode, I always liked getting back the whole httpreq.

On 10/13/06, Steven Wittens <[EMAIL PROTECTED]> wrote:
> It seems that the 'success' callback of $.ajax was changed to accept
> as its first argument the actual parsed data rather than the xmlHttp
> object, in 1.0.2? This behaviour broke several Drupal features when I
> upgraded it to jQuery 1.0.2...
>
> We should really avoid such API changes in the future, or bump up the
> middle version digit instead. In jQuery, the line between what is a
> private function and what is an API call is indeed blurred (so
> guaranteeing compatibility across versions for everything is near-
> impossible), but it would be nice if this stuff was at least
> documented. I looked around and can't seem to find any mention of
> this on the 1.0.2 release notes or on this mailing list.
>
> In Drupal, we document all API changes on a page with before/after
> examples. If you build such a page when you commit changes to the
> repository, it's not that much work.
>
> Here's a snippet to document this change (if I got it right):
>
> == $.ajax callback changed ==
> In jQuery 1.0.2, the first argument to the 'succes' callback has been
> changed to return the actual data rather than the XMLHttpRequest
> object. Use the 'dataType' argument to $.ajax to control how the data
> is returned. Note that jQuery can now parse XML, JSON and JavaScript
> for you this way.
>
> // jQuery 1.0.1
> $.ajax( {
>success: function (xmlhttp) {
>  // do stuff with xmlhttp.responseText
>}
> );
> // jQuery 1.0.2
> $.ajax( {
>success: function (data) {
>  // do stuff with data
>}
> );
>
>
> Steven Wittens
>
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>


-- 
Ⓙⓐⓚⓔ - יעקב   ʝǡǩȩ   ᎫᎪᏦᎬ
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] $.ajax API change 1.0.2?

2006-10-13 Thread Steven Wittens
It seems that the 'success' callback of $.ajax was changed to accept  
as its first argument the actual parsed data rather than the xmlHttp  
object, in 1.0.2? This behaviour broke several Drupal features when I  
upgraded it to jQuery 1.0.2...

We should really avoid such API changes in the future, or bump up the  
middle version digit instead. In jQuery, the line between what is a  
private function and what is an API call is indeed blurred (so  
guaranteeing compatibility across versions for everything is near- 
impossible), but it would be nice if this stuff was at least  
documented. I looked around and can't seem to find any mention of  
this on the 1.0.2 release notes or on this mailing list.

In Drupal, we document all API changes on a page with before/after  
examples. If you build such a page when you commit changes to the  
repository, it's not that much work.

Here's a snippet to document this change (if I got it right):

== $.ajax callback changed ==
In jQuery 1.0.2, the first argument to the 'succes' callback has been  
changed to return the actual data rather than the XMLHttpRequest  
object. Use the 'dataType' argument to $.ajax to control how the data  
is returned. Note that jQuery can now parse XML, JSON and JavaScript  
for you this way.

// jQuery 1.0.1
$.ajax( {
   success: function (xmlhttp) {
 // do stuff with xmlhttp.responseText
   }
);
// jQuery 1.0.2
$.ajax( {
   success: function (data) {
 // do stuff with data
   }
);


Steven Wittens

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/