The stateChanged() and GetXmlHttpObject functions are the same as in the PHP AJAX Suggest chapter.
The showRSS() Function
Every time an option is selected in the input field, this function executes the following:
- Calls the GetXmlHttpObject() function to create an XMLHTTP object
- Defines the URL (filename) to send to the server
- Adds a parameter (q) to the URL with the selected option from the drop-down list
- Adds a random number to prevent the server from using a cached file
- Each time the readyState property changes, the stateChanged() function will be executed
- Opens the XMLHTTP object with the given URL
- Sends an HTTP request to the server
Example Explained - The PHP page
The PHP page called by the JavaScript code is called "getrss.php":
No comments:
Post a Comment