0
我面對的顯示值列表視圖問題電話差距android..My服務器連接working..pls幫助如何在phonegap中顯示listview?
function display()
{
$.ajax({
url: 'url',
type: 'GET',
data: {},
dataType: "json",
success: function(data){
$("#list").append("<li>"+title+"</li>");
alert('Data successfully display');
},
error: function(){
alert('There was an error');
}
});
體
<div data-role="content">
<div class="example-wrapper">
<input onclick="display()" type="button" value="display" />
<ul data-role="listview" id="list" data-theme="a"> </ul>
</div>
PHP
<?php
include_once('config/config.php');
$sql = 'SELECT title FROM mydiary';
$result=mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
echo json_encode($row['title']);
}
?>
當我嘗試點擊顯示按鈕時出現錯誤警報。
什麼是實際的URL在這裏? url:'url' – Avijit
你得到的錯誤提示是什麼? –
@radhu嘗試JsonP請求,因爲跨域Ajax調用由於相同的來源策略而不被允許。 –