我有一个 PHP 页面,其中包含以下内容:
<?php
class CallsClass {
var $conn1;
var $dataTable = "";
function calls() {
$this->conn1 = new Datasource("taylor", "dbproj", "root", "elves") or die("Could not connect");
$s1 = "SELECT id, UPPER(SUBSTRING_INDEX(fullname,' ',1)) as fullname, oldcode FROM `researcher` WHERE `display` = '1' AND fullname <> 'Jenny Porteous' AND fullname <> 'Carey-Lee Lendrum' AND fullname <> 'Carys Gibson'";
$result = $this->conn1->_execute($s1);
while ($row = $this->conn1->_nextAssocRow($result)) {
$fullName = $row['fullname'];
$dataTable .= $fullName;
}
echo json_encode($dataTable);
}
}
?>
I know want to call this with my Ajax function:
$(document).ready(function() {
$(function ()
{
$.ajax({
url: 'Queries/CallsQuery.php/calls',
dataType: 'json',
success: function(result)
{
//console.log(result);
}
});
});
我在 Google Chrome 开发工具中收到“OPTIONS file:///C:/Users/wesley/Desktop/Highcharts%20example/Queries/CallsQuery.php/calls() 资源无法加载”错误,有什么原因吗?
谢谢,韦斯利