HTML and CSS Reference
In-Depth Information
EXPLANATION ( CONTINUED )
2
This PHP function extracts the data from a global associative array called
$_REQUEST . It contains any name/value pairs of the HTML form sent with either
GET or POST requests; in this example, the array contains two elements: name
and “ Ellie ”. PHP's extract() function creates a variable, $name , for the name and
assigns it the value “Ellie” . (This information was sent in the request object's
open() method as “http://localhost/serverTime.php? name=”+yourname +“&ran-
dom=” + Math.random()).
3
The PHP echo statement returns the value of $name to the server where it is then
sent back to the Ajax program in the Ajax request object's responseText property.
4
The PHP date() function returns the hour, minute, and second, AM or PM. This
data is updated in the Ajax program every time the server sends a response. Re-
sults of this process are shown in Figures 18.9 through 18.13.
Figure 18.9 The page as it is initially displayed.
Figure 18.10 Once the user starts typing, the div box appears with the letters and
time.
Search WWH ::




Custom Search