我試圖讓我的公司爲我建立的網站工作自動完成,但我似乎無法獲得執行的jQuery功能。該網站建立在Wordpress之上。通過PHP錯誤jQuery自動完成
輸入線:
<strong>Customer: </strong> <input type='text' name='cust' id='cust'>
自動完成:
<script type='text/javascript'>
jQuery('#cust').autocomplete({
source : "Scripts/cust_search.php",
minLength:1
});
而且cust_search.php:
<?
$term = trim(strip_tags($_GET[ "term" ]));
$a_json = array();
$a_json_row = array();
if ($companies = $panther->get_results("SELECT Cust_ID, Cust_Name FROM Customer LIKE '%$term%' ORDER BY Cust_Name ASC;")) {
while ($row = mysqli_fetch_array($companies)) {
$a_json_row ["id"]=$panther->escape($row['Cust_ID']);
$a_json_row ["value"]=$panther->escape($row['Cust_Name']);
$a_json_row ["label"]=$panther->escape($row['Cust_Name']);
array_push($a_json, $a_json_row);
}
}
echo json_encode($a_json);
?>
你看了在瀏覽器的控制檯中的請求/響應? –