XML文件
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<results>
<result>
<Country_Code>IN</Country_Code>
<Country_Name>India</Country_Name>
<Region_Name>Gujarat</Region>
<City>Rajkot</City>
<lat>13.060422</lat>
<lng>80.24958300000003</lng>
</result>
<result>
<Country_Code>KE</Country_Code>
<Country_Name>Kenya</Country_Name>
<Region_Name>Vihiga</Region>
<City>Kakamega</City>
<lat>0.1182473</lat>
<lng>34.7334515999997</lng>
</result>
</results>
我想在文本框中输入latitude
和longitude
,然后在我的xml文件中输入它,它返回所有细节,如: -
country_code country_name region_name city lat and lng
有值
答案 0 :(得分:0)
试试这个火焰。
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<p id="someElement"></p>
<p id="anotherElement"></p>
<script>
var xml = "<rss version='2.0'><channel><title>RSS Title</title></channel></rss>",
xmlDoc = $.parseXML( xml ),
$xml = $( xmlDoc ),
$title = $xml.find( "title" );
/* append "RSS Title" to #someElement */
$( "#someElement" ).append( $title.text() );
/* change the title to "XML Title" */
$title.text( "XML Title" );
/* append "XML Title" to #anotherElement */
$( "#anotherElement" ).append( $title.text() );
</script>
</body>
</html>