Book Image

MooTools 1.2 Beginner's Guide

Book Image

MooTools 1.2 Beginner's Guide

Overview of this book

MooTools is a simple-to-use JavaScript library, ideal for people with basic JavaScript skills who want to elevate their web applications to a superior level. If you're a newcomer to MooTools looking to build dynamic, rich, and user-interactive web site applications this beginner's guide with its easy-to-follow step-by-step instructions is all you need to rapidly get to grips with MooTools.
Table of Contents (14 chapters)
MooTools 1.2 Beginner's Guide
Credits
About the Authors
About the Reviewer
Preface

Time for action—requesting remote data


Imagine that you have a file on the server that contains data that you'd like to use on a web page. We will devise a way to get that data, and then display it on our web page without requiring a page refresh.

  1. Create an HTML document that will hold our remote data, and save it with the file name of mydata.html.

  2. In mydata.html, put in some HTML content. This is what I used, but feel free to put your own valid HTML markup:

    <p>This is some <strong>remote</strong> data that I requested.</p>
    
  3. Next we need an HTML document that will be our web page that requests the data from mydata.html. Create this HTML document and place it in the same location as mydata.html.

  4. In our web page HTML document, we place an<a> element that will serve as the trigger for making our Ajax request. This document also has a div where we will place the data we get from mydata.html; give this div an ID of content-holder. In the HTML document, we use the following...