PHP and AJAXresponseXML instances

Source: Internet
Author: User
PHP and AJAXresponseXML instances AJAX can be used to return database information in XML.

AJAX Database to XML instance (Test Description: This instance function is not implemented)

In the following AJAX example, we will demonstrate how to read information from the MySQL database, convert the data to an XML document, and use this document in different places to display information.

This example is similar to the "php ajax Database" example in the previous section, but there is a big difference: In this example, we use the responseXML function to obtain XML data from the PHP page.

Receiving XML documents as responses gives us the ability to update multiple locations on the page, not just receiving and displaying a PHP output.

In this example, we use the information received from the database to update multiple elements.

In the drop-down list, Select a User: Peter Griffin in Lois Griffin in Joseph Swanson Glenn Quagmire.

This column consists of four elements:

MySQL database simple HTML form JavaScript PHP page

Database

The database used in this example looks like this:

Id FirstName LastName Age Hometown Job
1 Peter Griffin in 41 Quahog Brewery
2 Lois Griffin in 40 Newport Piano Teacher
3 Joseph Swanson 39 Quahog Police Officer
4 Glenn Quagmire 41 Quahog Pilot

HTML form

The preceding example contains a simple HTML form and a link to JavaScript:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.