配置var serviceURL = //localhost/services/
すると動作し、データベースが表示されますが、オンラインにするとサーバーが動作しません。誰でも私を助けることができますか?PhoneGap を使用して XCode に取り組んでいます。
これは私のlist.js getJSON
var serviceURL = "http://panchoslimi.bugs3.com/services/";
var employees;
$('#employeeListPage').bind('pageinit', function(event) {
getEmployeeList();
});
function getEmployeeList() {
$.getJSON(serviceURL + 'getDoctors.php',function(data){
$('#employeeList li').remove();
employees = data.items;
$.each(employees, function(index, employee) {
$('#employeeList').append('<li> <a href="DoctorDetails.html?id=' + employee.id + '">' +
'<h4> Dr. ' + employee.firstName + ' ' + employee.lastName + '</h4>' +
'<p>' + employee.title + '</p>');
});
$('#employeeList').listview('refresh');
});
}
<?php
include 'config.php';
$sql = "SELECT e.id, e.firstName, e.lastName, e.title, e.picture, count(r.id)
reportCount " .
"FROM employee e left join employee r on r.managerId = e.id " .
"GROUP BY e.id ORDER BY e.lastName, e.firstName";
try {
$dbh = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass);
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $dbh->query($sql);
$MMC = $stmt->fetchAll(PDO::FETCH_OBJ);
$dbh = null;
echo '{"items":'. json_encode($MMC) .'}';
} catch(PDOException $M) {
echo '{"error":{"text":'. $M->getMessage() .'}}';
}
?>