作者:SureChueng | 来源:互联网 | 2022-01-05 06:49
本文实例讲述了jQuery读取XML文件的方法。分享给大家供大家参考,具体如下:
<&#63;xml version="1.0" encoding="utf-8" &#63;>
0
500
5
0
500
2000
10
25
2000
5000
15
125
5000
20000
20
375
20000
40000
25
1375
40000
60000
30
3375
60000
80000
35
6375
80000
100000
40
10375
100000
99999999
45
15375
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.jb51.net/code/xmljson
在线格式化XML/在线压缩XML:
http://tools.jb51.net/code/xmlformat
XML在线压缩/格式化工具:
http://tools.jb51.net/code/xml_format_compress
xml代码在线格式化美化工具:
http://tools.jb51.net/code/xmlcodeformat
更多关于jQuery相关内容感兴趣的读者可查看本站专题:《jQuery操作xml技巧总结》、《jQuery操作json数据技巧汇总》、《jQuery扩展技巧总结》、《jQuery常用插件及用法总结》、《jQuery常见经典特效汇总》及《jquery选择器用法总结》
希望本文所述对大家jQuery程序设计有所帮助。