In our first example we will send a number to our server, which will reply with that number squared. This is all the code we will use on our server:
<?php $val = floatval($_REQUEST["value"]); echo ($val * $val); ?>
If we type in our browser http://localhost/yuisite/squared.php?value=5
we will get back 25. This simple server script shows us something very important. Although the AJAX transactions are transparent to our users, they are very simple HTTP requests, which we can initiate from our browsers, so a good way to test if our server is responding appropriately is to simply type a request and see what comes back. Also, as we see in this example, there doesn't need to be any XML involved at all.
Using our usual template for our test pages, we add:
<form id="form" method="get" action="squarer.php"> <input type="text" name="value" id="value" /> <input type="submit" name="submit"/> </form> <div id="result"></div>
In the headers, besides...