O'Reilly logo

MooTools 1.3 Cookbook by Jay Larry G. Johnston

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Making an Ajax call

Getting ready

Asynchronous JavaScript and XML (Ajax) saves time by updating a page without refreshing it completely. Ajax has been around for a long time, with varied limits of browser support. It is safe to say that Google is most guilty of showing the world how easy it is to use.

How to do it...

Now with the MooTools abstraction layer's Request object, Ajax is child's play.

<script type="text/javascript" src="mootools-1.3.0.js"></script> </head> <body> <form action="" method="get"> <input type="button" id="mybutton" value="Ajax!" onclick="ajax_it();"/> </form> <script type="text/javascript"> var myJax = new Request({ url: '?', onSuccess: function(response) { alert('Success! Here is the response: ' +response); } }); function ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required