我试图让我的公司为我建立的网站工作自动完成,但我似乎无法获得执行的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);
?>
你看了在浏览器的控制台中的请求/响应? –