MooTools uses a Class called Request.
// create a new Class instance
var myRequest = new Request({
url: 'getMyText.php',
method: 'get',
onRequest: function(){
myElement.set('text', 'loading...');
},
onSuccess: function(responseText){
myElement.set('text', responseText);
},
onFailure: function(){
myElement.set('text', 'Sorry, your request failed :(');
}
});
// and to send it:
myRequest.send(data);
No comments:
Post a Comment