tags:

views:

399

answers:

1

Hi All,

How can i create a new Ajax object everytime for a particular ajax request, using Prototype library? It seems in Prototype, "Ajax" is a global object and all reqs are its instances. Please help..

Thanks

+1  A: 

Actually, Prototype creates a new "instance" for each request. You do it like this:

var request = new Ajax.Request('/your/url', {
  onSuccess: function(transport) {
      // yada yada yada
  }
});

Normally you skip the "var request = " part, unless you need access to the public properties of the instance. One possible reason would be to access the "transport" property which contains the "raw" XMLHttpRequest object.

Helgi