Displaying remote data via Ajax within a DIV

This recipe gets us ready for this chapter where Ajax is an idea of grabbing external data and bringing it into our current, already loaded page.

Getting ready

Prepare a small web page that is loaded with a static data "hello world". Name it 05_hello_world.html.

<html>
<head><title>Display Local Data via Ajax Within A DIV</title></head>
<body>Hello World</body>
</html>

How to do it...

We will simply be loading this page via Ajax into the DOM on our page.

<script type="text/javascript" src="mootools-1.3.0.js"></script> </head> <body> <form action="javascript:" method="get"> <input type="button" id="mybutton" value="Ajax!" onclick="myJax.send();"/> </form> <fieldset style="padding:10px;"><legend>My Ajax ...

Get MooTools 1.3 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.