zoukankan      html  css  js  c++  java
  • JQuery读取XML文件

    1 <?xml version="1.0" encoding="utf-8" ?>
    2  <taxrates>
    3 <taxrate id="1">
    4 <lower>0</lower>
    5 <upper>500</upper>
    6 <rate>5</rate>
    7 <buckle>0</buckle>
    8 </taxrate>
    9 <taxrate id="2">
    10 <lower>500</lower>
    11 <upper>2000</upper>
    12 <rate>10</rate>
    13 <buckle>25</buckle>
    14 </taxrate>
    15 <taxrate id="3">
    16 <lower>2000</lower>
    17 <upper>5000</upper>
    18 <rate>15</rate>
    19 <buckle>125</buckle>
    20 </taxrate>
    21 <taxrate id="4">
    22 <lower>5000</lower>
    23 <upper>20000</upper>
    24 <rate>20</rate>
    25 <buckle>375</buckle>
    26 </taxrate>
    27 <taxrate id="5">
    28 <lower>20000</lower>
    29 <upper>40000</upper>
    30 <rate>25</rate>
    31 <buckle>1375</buckle>
    32 </taxrate>
    33 <taxrate id="6">
    34 <lower>40000</lower>
    35 <upper>60000</upper>
    36 <rate>30</rate>
    37 <buckle>3375</buckle>
    38 </taxrate>
    39 <taxrate id="7">
    40 <lower>60000</lower>
    41 <upper>80000</upper>
    42 <rate>35</rate>
    43 <buckle>6375</buckle>
    44 </taxrate>
    45 <taxrate id="8">
    46 <lower>80000</lower>
    47 <upper>100000</upper>
    48 <rate>40</rate>
    49 <buckle>10375</buckle>
    50 </taxrate>
    51 <taxrate id="9">
    52 <lower>100000</lower>
    53 <upper>99999999</upper>
    54 <rate>45</rate>
    55 <buckle>15375</buckle>
    56 </taxrate>
    57 </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();
    ///后续操作。。。
    });
    }
    });
    }

    jquery代码

  • 相关阅读:
    NET領域模型(1)
    oracle 函數索引(1)
    oracle 動態SQL(1)
    WF事件驱动(5)
    WF事件驱动(3)
    WF事件驱动(4)
    HP LoadRunner 11.00 新鲜尝
    Tomcat配置优化要点
    WebSphere性能诊断与调优
    性能测试工具、监控工具
  • 原文地址:https://www.cnblogs.com/huacw/p/1994074.html
Copyright © 2011-2022 走看看