我想從一個.xml文件中讀取一些信息,並使用jQuery Mobile在列表視圖上顯示它..我搜索了各種方法,我只是不能做到這一點... 有人可以幫幫我嗎?閱讀從XML - 輸出有jQuery Mobile列表視圖
感謝
<!DOCTYPE html>
<html>
<head>
<title>XXXXXX</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/jqm-docs.css" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>
腳本去獲取信息,從標誌物
<script type="text/javascript">
function initialize() {
jQuery.get("markers.xml", {}, function(data) {
jQuery(data).find("marker").each(function() {
var marker = jQuery(this);
var name = marker.attr("name");
$("last").append('<li class="arrow">' + name + '</li>');
});
});
}
</script>
</head>
HTML身體..是div = ID是否正確?
<body onLoad="initialize()">
<div data-role="page" class="type-home">
<div data-role="header">
<h1>XXX</h1>
</div>
<div data-role="content">
<div class="content-secondary">
<div id="jqm-homeheader">
<h1 id="jqm-logo"><img src="images/logo_final.jpg"/></h1>
</div>
<ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b">
<li data-role="list-divider">Menu</li>
<li class="arrow"><a href="inserir.html" data-transition="slide">Inserir</a></li>
<li class="arrow"><a href="find.html" data-transition="slide">Procurar</a></li>
<li class="arrow"><a href="map.html" data-transition="slide">Mapa</a></li>
<li class="arrow"><a href="contact_us.html" data-transition="slide">Termos e Condições</a></li>
<li class="arrow"><a href="contact_us.html" data-transition="slide">Contact Us</a></li>
</ul>
</div>
<div class="content-primary" id="last">
<ul data-role="listview">
<li data-role="list-divider">Ultimos:</li>
</ul>
</div>
</div>
</div>
</body>
</html>
----------------------- UPDATE ------------
XML代碼
<?xml version="1.0" encoding="utf-8"?>
<!--
- Database: 'ond68nda_dataBase'
-->
<database name="ond68nda_dataBase">
<!-- Table markers -->
<table name="markers">
<column name="id">1</column>
<column name="name">asd</column>
<column name="address">dasd</column>
<column name="lat">37.437130</column>
<column name="lng">-122.117012</column>
<column name="type">restaurant</column>
</table>
<table name="markers">
<column name="id">2</column>
<column name="name">asd</column>
<column name="address">dasd</column>
<column name="lat">37.437130</column>
<column name="lng">-122.117012</column>
<column name="type">restaurant</column>
</table>
<table name="markers">
<column name="id">3</column>
<column name="name">dasd</column>
<column name="address">dasdas</column>
<column name="lat">37.440266</column>
<column name="lng">-122.137436</column>
<column name="type">restaurant</column>
</table>
<table name="markers">
<column name="id">4</column>
<column name="name"></column>
<column name="address"></column>
<column name="lat">0.000000</column>
<column name="lng">0.000000</column>
<column name="type"></column>
</table>
你可以對哪些問題更具體你是否面臨 – 2011-12-28 19:33:00