我正在学习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