Multi-level linkage series -- ajax calls XML for three-level linkage

Source: Internet
Author: User

Ajax is especially convenient to use and there is no worries about browser compatibility. Use ajax to call the content on the XML page to generate a three-level linkage. I don't need to talk much about it. Follow me to write it step by step.

First, write an XML file. Data. xml

<? Xml version = "1.0" encoding = "UTF-8"?> <List> <province name = "Henan" id = '1'> <city name = "Jiaozuo" id = '11'> <area id = '000000'> Wuzhi </ area> <area id = '000000'> boai </area> <area id = '000000'> xiuwu </area> </city> <city name = "Zhengzhou" id = '12'> <area id = '000000'> jinshui district </area> <area id = '000000'> Zone 2 and 7 </area> <area id = '000000'> Central Plains district </area> </city> </province> <province name = "Hebei" id = '2'> <city name = "Shijiazhuang" id = '21'> <area id = '000000'> Zhao County </area> <area id = '000000'> Zhengding </area> <area id = '000000'> Pingshan </area> </ city> <city name = "Chengde" id = '22'> <area id = '000000'> Field </area> <area id = '000000'> Fengning </area> <area id = '000000'> Longhua </area> </city> </province> <province name = "Shandong" id = '3'> <city name =" qingdao "id = '31'> <area id = '000000'> licang </area> <area id = '000000'> Laoshan </area> <area id = '000000' '> Huangdao </area> </city> <city name = "Rizhao" id = '32'> <area id = '000000'> Donggang </area> <area id = '000000'> lanshan </area> <area id = '000000'> wulian </area> </city> </province> </list>

Then we need to use ajax to call XML to generate a three-level linkage.

Below is the Code Section

<! DOCTYPE html> 

OK. According to this three-level linkage, N-level linkage can be extended. The principles are the same. Okay, that's it.


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.