Building a calculator using Ajax

Included with the book are two versions of the calculator processor, the server-side script that processes the Ajax requests and provides responses. All server-side scripts used in recipes in this book have both a PHP and ColdFusion version. The recipe below, as all do, shows the PHP script installed in the URL of the Ajax call; one must only switch the file ending to .cfm to use the ColdFusion version. The two scripts process identically.

How to do it...

There are five main code blocks in the JavaScript; we will stop before each code block to review in detail.

<script type="text/javascript" src="mootools-1.3.0.js"></script> </head> <body> <div id="main"> <h1>Mortgage ratio calculator</h1> <form action="javascript:" ...

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.