|
Write a comment |
Articles |
DHTML Gallery |
.NET |
MyBlog |
About Me |
FAQ
|
|
|
Doing AJAX with popular javascript libraries
| Basic | Prototype.js | Dojo Toolkit | Yahoo UI Library | ASP.NET | Rails |
Prototype.js
new Ajax.Request(url,
{
method:'get',
onSuccess: function(response){alert(response.responseText);},
onFailure: function(){ alert('There was a problem.') }
});
You can assign following callback methods (in addition to onSuccess and onFailure). onUninitialized onLoading onLoaded onInteractive onComplete That's not all, the library also has 'Ajax.Updater' which can be used to refresh a section of webpage with HTML coming from server
var myAjax = new Ajax.Updater(
placeholder_id,
url,
{
method: 'get',
parameters: params
}
);
Here the contents of an element which whose id is 'placeholder_id' are replaced with response of the request. The AJAX request is made after appending the 'params' to the url. Prototype is a very well written javascript library. It can do incredible things. Make sure you check out its website here: http://www.prototypejs.org/learn/introduction-to-ajax http://www.prototypejs.org/learn/json
| Basic | Prototype.js | Dojo Toolkit | Yahoo UI Library | ASP.NET | Rails | |
| Copyright (c) 2007-2008 Ashish Patil . Please read FAQ for more details. |