Ajax has become a very important part of the modern web and that won’t change in the near future. The MooTools Framework has made Ajax so simple that even a newbie developer can get their dynamic pages working in no time.
The xhtml part looks like this:
Since version 1.2 you must create an instance of the Request class. We provide our request with the method get (post is certainly provided too), the URL, optional data information, and optional onRequest and onComplete event handlers.
$('start').addEvent('click', function(event) {
event.stop();
var url = "ajax.php";
var req = new Request({
method: 'get'
,url: url
,data: { 'do' : 1 },
onRequest: function() { },
onComplete: function(response) {
$('log').set('html', response);
}
}).send();
});
And that’s how you made it with the old mootools version 1.1.. but we don’t use that anymore
e = new Event(e).stop();
var url = "ajax.php";
new Ajax(url, {method: 'get',update: $('log')
}).request();
});
Posted in MooTools | Trackback Url








One Response to “Ajax Request Using MooTools 1.2”
1
Dan
November 28th, 2009
Permalink this comment
thanks for posting...
0 Trackbacks/Pingbacks
Leave a reply