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.
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:" method="get" onsubmit="send_form();"> <div id="calculator"> <div id="screen" class="key">0</div> <input type="button" class="key" value="7"/> <input type="button" class=...