Ajax returns XML type

Source: Internet
Author: User

XML, like HTML, is a text markup language, unlike HTML, which is a Hypertext markup language used primarily for presentation. XML is an Extensible Markup language that is used primarily for data transfer.

XML Features:
1. Tree-like structure with only one root
2. Label name customization
3. Label name is sensitive, it is a double label element
4. Duplicate label cannot appear at the same level

Let's take a look at the following table:

Let's get to the NAME1 column in this table:

<title>Untitled Document</title><Scriptsrc= "Jquery-3.2.0.min.js"></Script></Head><Body><DivID= "Shuju"></Div></Body><Scripttype= "Text/javascript">$.ajax ({URL:"xmlchuli.php", DataType:"XML", Success:function(data) {varZi=$ (data). Find ("Minzu"). Children (); varStr= "";  for(varI=0; I<Zi.length;i++)        {            //Zi.eq (i). Find ("code"). Text ();            varname1=Zi.eq (i). Find ("name1"). text (); STR=Str+"<div>"+name1+"</div>"; }        $("#shuju"). html (str); }});</Script></Body></HTML>

Processing page:

<?PHPrequire"DBDA.class.php";$db=NewDbda ();$sql= "SELECT * FROM Minzu";$arr=$db->query ($sql);Echo"<minzu>";foreach($arr  as $k=$v){    Echo"<n{$k}><code>{$v[0]} </code><name1>{$v[1]} </name1></n{$k}> ";}Echo"</minzu>";

Show Graph:

Ajax returns XML type

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.