我正在學習JQuery移動(所以我很抱歉如果我的問題的答案是非常明顯的)。JQuery Mobile html + php + phonegap問題
我修改了一個簡單的數據列表示例,使用PHP獲取JSON數據並使用它填充我的列表。我的代碼如下:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="//code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.css">
<script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="//code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.js"></script>
</head>
<body>
<div data-role='page'>
<div data-role='header'>
testing ... testing
</div>
<?php
print "<br>PHP Working!<br>: " + date('d') + "<br>";
$json = file_get_contents('http://*.*.*.*/mysite/app/sections');
$sections = json_decode($json, true);
$sections = $sections['JSON'];
?>
<ul data-role='listview'>
<?php
foreach ($sections as $key => $section) {
?>
<li><?php print "<a href='#/{$section['tid']}'>{$section['term']}</a>" ?></li>
<?php
}
?>
</ul>
</div>
</body>
</html>
在Web瀏覽器的輸出如下圖所示:
我的問題是,當我使用PhoneGap的生成Android移動應用,它加載但只是將我的PHP代碼打印爲文本。
任何人都可以告訴我,如果我正在嘗試是可能的,如果是的話,我能做些什麼來解決這個問題?
你需要在追加項目'$(「ul」)。listview(「refresh」);'後刷新listview。 – Omar