Minor API Change in 1.0.2

Posted on by

I forgot to mention in the 1.0.2 release notes, the other day, that there was a minor API change. This was a mistake, as we should’ve held off on making an API change until the next major release (jQuery 1.1).

As summarized by Steven Wittens, here is the premise behind the change:

In jQuery 1.0.2, the first argument to the ‘success’ 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) {
    var data = $.httpData( xmlhttp );
    // 'data' holds the response data from the server
  }
);

jQuery 1.0.2

$.ajax( {
  success: function (data) {
    // 'data' holds the response data from the server
  }
);

Thanks, Steven, for the synopsis – and sorry, everyone, for the inconvenience!

6 thoughts on “Minor API Change in 1.0.2

  1. Wow that’s great!
    The other day I was wondering why it returned the ‘XMLHttpRequest object’ because the response data would have made more sense. :)

  2. Pingback: KeBlog :: Kej’s weblog » jQuery 1.0.2

  3. Oh man! I suffered with this!
    I gave up and returned to the precedent release.
    Now happy to see what happened :) Thanks!

  4. I am really sorry for posting this here but I could not find a way to post something to this Bug Tracker and I may care for jQuery but I am not the mailing list guy, so I’d liek to just report this: while the .ready() works fine in the online version of my site under Opera 9 (latest build), on my local version (running on apache) it fails badly when a page is reloaded but works for the first time the page is accessed. The weird thing is that it returns no erros in the Error Console.Note that this only happens in Opera. Maybe someone could look at it?
    Thank you in advance.