CD info will be listed here...
The showCD() function performs the following steps:
* Check if a CD is selected
* Create an XMLHttpRequest object
* Create the function to be executed when the server response is ready
* Send the request to a file on the server
* Note that a parameter (q) is added to the end of the URL (containing the content of the dropdown list)
* * *
## The PHP File
The server page called by the JavaScript above is a PHP file named "getcd.php".
The PHP script loads an XML document, "[cd_catalog.xml](#)", runs a query against the XML file, and returns the result as HTML:
load("cd_catalog.xml"); $x=$xmlDoc->getElementsByTagName('ARTIST');for ($i=0; $ilength-1; $i++){// Process - only element node typeif ($x->item($i)->nodeType==1){if ($x->item($i)->childNodes->item(0)->nodeValue == $q){$y=($x->item($i)->parentNode);}}} $cd=($y->childNodes);for ($i=0;$ilength;$i++){ // Process - only element node typeif ($cd->item($i)->nodeType==1){echo("" . $cd->item($i)->nodeName . ": ");echo($cd->item($i)->childNodes->item(0)->nodeValue);echo("");}}?> When the CD query is sent from JavaScript to the PHP page, the following happens: 1. PHP creates an XML DOM object 2. It finds all elements to match the name passed from JavaScript 3. It outputs the album information and sends it back to the "txtHint" placeholder [](#)(#) (#)
YouTip