New Version of jQuery Released

13 December 2006 | Tutorials | 1 Comment

From the creator of "15 Days of jQuery" (me):

Just announced today, version 1.0.4 of jQuery was released. I’ll be updating my installation of jQuery on the 15 Days of jQuery blog and also releasing new tutorials in the coming days and weeks.

John Resig and company squashed a whole bunch of bugs.

They also added some innovative features I’ll have to investigate further, and then I’ll whip up some new tutorials. (Yes, it’s been a while since I posted. I do these in spurts, and I feel one comin’ on.)

As far as specifics on features, some of the cooler ones look like extensions to the $.ajax()

A few examples straight off of John Resig’s blog:

Example: Add extra headers to an Ajax request using beforeSend

$.ajax({
  type: "POST",
  url: "/files/add/",
  beforeSend: function(xhr) {
    xhr.setRequestHeader( "Content-type", "text/plain" );
  },
  data: "This is the contents of my text file."
});

Example: Perform a synchronous Ajax request.

// Get the HTML of a web page and save it
// to a variable (the browser will freeze until the
// entire request is completed).
var html = $.ajax({
  type: "GET",
  url: "test.html",
  async: false
}).responseText;

// Add the HTML into the page
$("#list").html( html );

Example: Sending a JavaScript object using processData.

// The data to send to the server
var params = {
  name: "John",
  city: "Boston"
};

$.ajax({
  type: "POST",
  url: "/user/add/",
  processData: params
});

Example: Aborting an Ajax request after a specific delay in time.

// Perform a simple Ajax request
var req = $.ajax({
  type: "GET",
  url: "/user/list/",
  success: function(data) {
    // Do something with the data...
    // Then remove the request.
    req = null;
  }
});

// Wait for 5 seconds
setTimeout(function(){
  // If the request is still running, abort it.
  if ( req ) req.abort();
}, 5000);

Another nice addition is a way to make pageX and pageY variables available in all browsers.

Example: Have a tooltip follow a user’s mouse around the page.

$(document).mousemove(function(e){
  $("#mousetip").css({
    top: e.pageY + "px",
    left: e.pageX + "px"
  });
});

I’ll have to take a closer look at these new features, play around a bit, and post my findings in some new tutorials. I got a comment today about the old AJAX tutorial I did a while back being a bit outdated with the video cast I did, and some of the new $.ajax() calls in jQuery, so I think it’s time to revisit jQuery’s implementation of AJAX and crank out a few new tutorials.

Stay tuned.

Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.

Subscribe

Email Updates:
Email:
RSS Feed:

RSS information | Email Policy | RSS to Email by Aweber

1 Comment

  1. Saurin said on 9 Oct 2007 at 12:51 am:

    Hi there,

    I saw your examples and helps. Its great. I am looking for small help if its possible.

    I am launching my perl script through ajax and specify to give me output to analyze some data which takes long time.

    Is it possible for me to display a server progress indicator with server response with how much data have been analyzed and also my browser connection open for that request.

    please let me know whenever you get chance. Any help will be good.

    Thank you so much for your time and help,
    Saurin Jani

Leave a Reply

You can follow the discussion through the Comments feed. You can also pingback or trackback from your own site.