国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

jQuery讀取XML文件的方法示例

2019-11-19 17:45:24
字體:
來源:轉載
供稿:網友

本文實例講述了jQuery讀取XML文件的方法。分享給大家供大家參考,具體如下:

<?xml version="1.0" encoding="utf-8" ?> <taxrates> <taxrate id="1">  <lower>0</lower>  <upper>500</upper>  <rate>5</rate>  <buckle>0</buckle> </taxrate> <taxrate id="2">  <lower>500</lower>  <upper>2000</upper>  <rate>10</rate>  <buckle>25</buckle> </taxrate> <taxrate id="3">  <lower>2000</lower>  <upper>5000</upper>  <rate>15</rate>  <buckle>125</buckle> </taxrate> <taxrate id="4">  <lower>5000</lower>  <upper>20000</upper>  <rate>20</rate>  <buckle>375</buckle> </taxrate> <taxrate id="5">  <lower>20000</lower>  <upper>40000</upper>  <rate>25</rate>  <buckle>1375</buckle> </taxrate> <taxrate id="6">  <lower>40000</lower>  <upper>60000</upper>  <rate>30</rate>  <buckle>3375</buckle> </taxrate> <taxrate id="7">  <lower>60000</lower>  <upper>80000</upper>  <rate>35</rate>  <buckle>6375</buckle> </taxrate> <taxrate id="8">  <lower>80000</lower>  <upper>100000</upper>  <rate>40</rate>  <buckle>10375</buckle> </taxrate> <taxrate id="9">  <lower>100000</lower>  <upper>99999999</upper>  <rate>45</rate>  <buckle>15375</buckle> </taxrate></taxrates>
function StandardTaxRate(){  $.ajax({    url: "/Resource/salaryTaxRate.xml",    dataType: 'xml',    type: 'GET',    timeout: 2000,    error: function(xml)    {      alert("加載XML 文件出錯!");    },    success: function(xml)    {      $(xml).find("taxrate").each(function(i)      {        var oid = $(this).attr("id");        var lower = $(this).children("lower").text();        var upper = $(this).children("upper").text();        var rate = $(this).children("rate").text();        var buckle = $(this).children("buckle").text();        ///后續操作。。。      });    }  });}

PS:這里再為大家提供幾款關于xml操作相關在線工具供大家參考使用:

在線XML/JSON互相轉換工具:
http://tools.VeVB.COm/code/xmljson

在線格式化XML/在線壓縮XML
http://tools.VeVB.COm/code/xmlformat

XML在線壓縮/格式化工具:
http://tools.VeVB.COm/code/xml_format_compress

xml代碼在線格式化美化工具:
http://tools.VeVB.COm/code/xmlcodeformat

更多關于jQuery相關內容感興趣的讀者可查看本站專題:《jQuery操作xml技巧總結》、《jQuery操作json數據技巧匯總》、《jQuery擴展技巧總結》、《jQuery常用插件及用法總結》、《jQuery常見經典特效匯總》及《jquery選擇器用法總結

希望本文所述對大家jQuery程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 隆化县| 钦州市| 杭州市| 海淀区| 霍邱县| 天峻县| 彰化市| 偃师市| 万盛区| 汤原县| 巨鹿县| 江门市| 云龙县| 永胜县| 彭山县| 友谊县| 镇赉县| 华坪县| 天长市| 双流县| 剑川县| 溧水县| 莱西市| 韶山市| 湾仔区| 南开区| 葵青区| 越西县| 上思县| 莱芜市| 道真| 清涧县| 南岸区| 仪征市| 涿州市| 巢湖市| 营山县| 怀集县| 连平县| 武穴市| 密山市|